From: Ben Pfaff Date: Thu, 10 Jul 2008 00:22:17 +0000 (-0700) Subject: New function ds_clear(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f10a48ce3a3c4d36fedcca183e48e72ec2ce0355;p=openvswitch New function ds_clear(). --- diff --git a/include/dynamic-string.h b/include/dynamic-string.h index e43d006a..ea69c6af 100644 --- a/include/dynamic-string.h +++ b/include/dynamic-string.h @@ -49,6 +49,7 @@ struct ds { #define DS_EMPTY_INITIALIZER { NULL, 0, 0 } void ds_init(struct ds *); +void ds_clear(struct ds *); void ds_reserve(struct ds *, size_t min_length); void ds_put_char(struct ds *, char); void ds_put_cstr(struct ds *, const char *); diff --git a/lib/dynamic-string.c b/lib/dynamic-string.c index 68dd3419..f08e8cb5 100644 --- a/lib/dynamic-string.c +++ b/lib/dynamic-string.c @@ -45,6 +45,12 @@ ds_init(struct ds *ds) ds->allocated = 0; } +void +ds_clear(struct ds *ds) +{ + ds->length = 0; +} + void ds_reserve(struct ds *ds, size_t min_length) {