/*
- * Copyright (c) 2008 Nicira Networks.
+ * Copyright (c) 2008, 2009 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return ds->string;
}
+/* 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'. */
+char *
+ds_steal_cstr(struct ds *ds)
+{
+ char *s = ds_cstr(ds);
+ ds_init(ds);
+ return s;
+}
+
void
ds_destroy(struct ds *ds)
{
/*
- * Copyright (c) 2008 Nicira Networks.
+ * Copyright (c) 2008, 2009 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
int ds_get_line(struct ds *, FILE *);
char *ds_cstr(struct ds *);
+char *ds_steal_cstr(struct ds *);
void ds_destroy(struct ds *);
int ds_last(const struct ds *);