New function ds_clear().
authorBen Pfaff <blp@nicira.com>
Thu, 10 Jul 2008 00:22:17 +0000 (17:22 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 18 Jul 2008 20:42:37 +0000 (13:42 -0700)
include/dynamic-string.h
lib/dynamic-string.c

index e43d006..ea69c6a 100644 (file)
@@ -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 *);
index 68dd341..f08e8cb 100644 (file)
@@ -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)
 {