From 5f98eed4eb5b75ab02422de1b5dbd5276ad5593d Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 16 Dec 2009 11:28:13 -0800 Subject: [PATCH] dynamic-string: New function ds_cstr_ro(). --- lib/dynamic-string.c | 6 ++++++ lib/dynamic-string.h | 1 + 2 files changed, 7 insertions(+) diff --git a/lib/dynamic-string.c b/lib/dynamic-string.c index 527dee8a..7f5e3fba 100644 --- a/lib/dynamic-string.c +++ b/lib/dynamic-string.c @@ -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'. */ diff --git a/lib/dynamic-string.h b/lib/dynamic-string.h index 136cedc9..dc81fb3a 100644 --- a/lib/dynamic-string.h +++ b/lib/dynamic-string.h @@ -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 *); -- 2.30.2