From: Guillem Jover Date: Mon, 9 Jun 2008 22:25:23 +0000 (+0300) Subject: libdpkg: Make varbufprintf use varbufvprintf instead of reimplementing it X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2898cfd37a1b134d081111b162d2515d495e413;p=dpkg libdpkg: Make varbufprintf use varbufvprintf instead of reimplementing it --- 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; }