diff options
author | Adam Heath <doogie@debian.org> | 2001-01-01 08:08:56 +0000 |
---|---|---|
committer | Adam Heath <doogie@debian.org> | 2001-01-01 08:08:56 +0000 |
commit | eb45fbbd58961bdbe71bc2b4a85d5bdc6700eda4 (patch) | |
tree | 53cf374390a268160c19f1c5ee6a0183c8ef010d | |
parent | 0ee21bc313f7e64f8f639dd7947d2b24d514dbb2 (diff) | |
download | dpkg-eb45fbbd58961bdbe71bc2b4a85d5bdc6700eda4.tar.gz |
Add varbufdupc().
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | include/dpkg-db.h | 1 | ||||
-rw-r--r-- | lib/varbuf.c | 11 |
3 files changed, 17 insertions, 1 deletions
@@ -1,4 +1,8 @@ -Mon Jan 1 02:04:26 CST 2001 Wichert Akkerman <wakkerma@debian.org> +Mon Jan 1 02:07:47 CST 2001 Adam Heath <doogie@debian.org> + + * lib/varbuf.c, include/dpkg-db.h: Add varbufdupc(). + +Mon Jan 1 02:04:26 CST 2001 Adam Heath <doogie@debian.org> * lib/parse.c: Use of PKGIOFF macro was checked in prematurely. diff --git a/include/dpkg-db.h b/include/dpkg-db.h index d75cfbe98..bece2d045 100644 --- a/include/dpkg-db.h +++ b/include/dpkg-db.h @@ -225,6 +225,7 @@ const char *versiondescribe(const struct versionrevision*, struct varbuf; extern void varbufaddc(struct varbuf *v, int c); +extern void varbufdupc(struct varbuf *v, int c, ssize_t s); void varbufinit(struct varbuf *v); void varbufreset(struct varbuf *v); void varbufextend(struct varbuf *v); diff --git a/lib/varbuf.c b/lib/varbuf.c index 0c8f17704..ed33837b7 100644 --- a/lib/varbuf.c +++ b/lib/varbuf.c @@ -32,6 +32,17 @@ void varbufaddc(struct varbuf *v, int c) { v->buf[v->used++]= c; } +void varbufdupc(struct varbuf *v, int c, ssize_t n) { + char *b = v->buf + v->used; + v->used += n; + if (v->used >= v->size) varbufextend(v); + + while(n) { + *b= c; + b++; n--; + } +} + void varbufprintf(struct varbuf *v, const char *fmt, ...) { int ou, r; va_list al; |