From 4433cd3ff11b6bd0ab0a17a36d233102b47cffe7 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 1 Jun 2008 22:39:09 +0300 Subject: [PATCH] libdpkg: Use memset instead of ad-hoc operation --- ChangeLog | 4 ++++ lib/varbuf.c | 7 ++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 98d7fd39..47e83f2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-06-01 Guillem Jover + + * lib/varbuf.c (varbufdupc): Use memset instead of ad-hoc operation. + 2008-06-01 Guillem Jover * lib/subproc.c (setup_subproc_signals): Use size_t intead of int diff --git a/lib/varbuf.c b/lib/varbuf.c index 15dd15dd..3336f030 100644 --- a/lib/varbuf.c +++ b/lib/varbuf.c @@ -38,11 +38,8 @@ 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--; - } + + memset(b, c, n); } int varbufprintf(struct varbuf *v, const char *fmt, ...) { -- 2.39.5