#undef NDEBUG
[util-vserver.git] / util-vserver / lib_internal / string.hc
index 251d597..d003fd9 100644 (file)
@@ -21,3 +21,22 @@ String_init(String *str)
   str->d = 0;
   str->l = 0;
 }
+
+static inline UNUSED char const *
+String_c_str(String const *str, char *buf)
+{
+  if (str->l==0) return "";
+
+  if (buf!=str->d)
+    abort();   // TODO: copy content
+
+  buf[str->l] = '\0';
+  return buf;
+}
+
+
+static inline UNUSED void
+String_free(String *str)
+{
+  free((char *)(str->d));
+}