Code

Add more string utility functions and unit tests.
[sysdb.git] / src / include / utils / strings.h
index 61298ee7cc9d0e96d72bd02a4bb9a259aa07bc5f..24f7fc11f8aa8f0bef5d7227c7c7e5d38200e11b 100644 (file)
@@ -37,7 +37,8 @@ extern "C" {
 /*
  * stringv_copy:
  * Copy a string vector from 'src' to 'dst'. If non-NULL, 'dst' will be
- * reallocated to fit the required size.
+ * reallocated to fit the required size and old entries will be freed before
+ * overriding them.
  *
  * Returns:
  *  - 0 on success
@@ -47,6 +48,17 @@ int
 stringv_copy(char ***dst, size_t *dst_len,
                const char * const *src, size_t src_len);
 
+/*
+ * stringv_append:
+ * Append a string to a string vector.
+ *
+ * Returns:
+ *  - 0 on success
+ *  - a negative value else
+ */
+int
+stringv_append(char ***s, size_t *s_len, const char *elem);
+
 /*
  * stringv_free:
  * Free the memory used by 's' and all of it's elements.