dynamic-string: New function ds_cstr_ro().
authorBen Pfaff <blp@nicira.com>
Wed, 16 Dec 2009 19:28:13 +0000 (11:28 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 16 Dec 2009 19:28:13 +0000 (11:28 -0800)
lib/dynamic-string.c
lib/dynamic-string.h

index 527dee8..7f5e3fb 100644 (file)
@@ -219,6 +219,12 @@ ds_cstr(struct ds *ds)
     return ds->string;
 }
 
+const char *
+ds_cstr_ro(const struct ds *ds)
+{
+    return ds_cstr((struct ds *) ds);
+}
+
 /* Returns a null-terminated string representing the current contents of 'ds',
  * which the caller is expected to free with free(), then clears the contents
  * of 'ds'. */
index 136cedc..dc81fb3 100644 (file)
@@ -56,6 +56,7 @@ void ds_put_hex_dump(struct ds *ds, const void *buf_, size_t size,
 int ds_get_line(struct ds *, FILE *);
 
 char *ds_cstr(struct ds *);
+const char *ds_cstr_ro(const struct ds *);
 char *ds_steal_cstr(struct ds *);
 void ds_destroy(struct ds *);