X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fdynamic-string.c;h=7f5e3fbaac44b830d0cf9e527f0b3abc9fedbcb1;hb=e0668bd1d448d6f17c20b9c7ba91344180809061;hp=531e53bbe9ab9f2195d4a7481cd7aeea306439f4;hpb=f38b84ea2b6b61d309c604faedd41ab3b0fcf16b;p=openvswitch diff --git a/lib/dynamic-string.c b/lib/dynamic-string.c index 531e53bb..7f5e3fba 100644 --- a/lib/dynamic-string.c +++ b/lib/dynamic-string.c @@ -115,6 +115,13 @@ ds_put_cstr(struct ds *ds, const char *s) memcpy(ds_put_uninit(ds, s_len), s, s_len); } +void +ds_put_and_free_cstr(struct ds *ds, char *s) +{ + ds_put_cstr(ds, s); + free(s); +} + void ds_put_format(struct ds *ds, const char *format, ...) { @@ -212,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'. */