From: Ben Pfaff Date: Wed, 17 Dec 2008 00:39:01 +0000 (-0800) Subject: New function ds_put_buffer(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9882618603f4b26424c34c9e88c8d87456c6b23b;p=openvswitch New function ds_put_buffer(). --- diff --git a/lib/dynamic-string.c b/lib/dynamic-string.c index 2fe8cfb6..98711f0d 100644 --- a/lib/dynamic-string.c +++ b/lib/dynamic-string.c @@ -94,6 +94,12 @@ ds_put_char_multiple(struct ds *ds, char c, size_t n) memset(ds_put_uninit(ds, n), c, n); } +void +ds_put_buffer(struct ds *ds, const char *s, size_t n) +{ + memcpy(ds_put_uninit(ds, n), s, n); +} + void ds_put_cstr(struct ds *ds, const char *s) { diff --git a/lib/dynamic-string.h b/lib/dynamic-string.h index 7bd58cba..0fb5ce4c 100644 --- a/lib/dynamic-string.h +++ b/lib/dynamic-string.h @@ -57,6 +57,7 @@ void ds_reserve(struct ds *, size_t min_length); char *ds_put_uninit(struct ds *, size_t n); void ds_put_char(struct ds *, char); void ds_put_char_multiple(struct ds *, char, size_t n); +void ds_put_buffer(struct ds *, const char *, size_t n); void ds_put_cstr(struct ds *, const char *); void ds_put_format(struct ds *, const char *, ...) PRINTF_FORMAT(2, 3); void ds_put_format_valist(struct ds *, const char *, va_list)