From e2898cfd37a1b134d081111b162d2515d495e413 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 10 Jun 2008 01:25:23 +0300 Subject: [PATCH] libdpkg: Make varbufprintf use varbufvprintf instead of reimplementing it --- ChangeLog | 5 +++++ lib/varbuf.c | 14 +++----------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a692a95..5b6987ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-06-10 Guillem Jover + + * lib/varbuf.c (varbufprintf): Use varbufvprintf instead of + reimplementing it. + 2008-06-09 Guillem Jover * scripts/Dpkg/BuildOptions.pm (parse, set): Use space as the diff --git a/lib/varbuf.c b/lib/varbuf.c index 26556e18..63060c21 100644 --- a/lib/varbuf.c +++ b/lib/varbuf.c @@ -43,21 +43,13 @@ void varbufdupc(struct varbuf *v, int c, ssize_t n) { } int varbufprintf(struct varbuf *v, const char *fmt, ...) { - size_t ou; int r; va_list al; - ou= v->used; - v->used+= strlen(fmt); + va_start(al, fmt); + r = varbufvprintf(v, fmt, al); + va_end(al); - do { - varbufextend(v); - va_start(al,fmt); - r= vsnprintf(v->buf+ou,v->size-ou,fmt,al); - va_end(al); - if (r < 0) r= (v->size-ou+1) * 2; - v->used= ou+r; - } while (r >= (int)(v->size - ou - 1)); return r; } -- 2.39.5