aboutsummaryrefslogtreecommitdiff
path: root/lib/strlist.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@users.noreply.github.com>2020-05-21 19:10:14 -0400
committerGitHub <noreply@github.com>2020-05-21 19:10:14 -0400
commit03e39ae5dcd4002ac9657a550c48b8e9f85c449c (patch)
tree7c266ca17a16d4c9ca297fa402a0a9d2ee6f871f /lib/strlist.c
parent3b323fcc82d3d06d671c55c2b77f74558706420e (diff)
parent86b2a55574f53c6e175de8cf745d2e67308b612e (diff)
downloadspmc-03e39ae5dcd4002ac9657a550c48b8e9f85c449c.tar.gz
Merge pull request #36 from jhunkeler/messing-around
Version parsing and Darwin bugfix
Diffstat (limited to 'lib/strlist.c')
-rw-r--r--lib/strlist.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/strlist.c b/lib/strlist.c
index 3de10dd..aac2755 100644
--- a/lib/strlist.c
+++ b/lib/strlist.c
@@ -83,6 +83,28 @@ void strlist_append_strlist(StrList *pStrList1, StrList *pStrList2) {
}
/**
+ * Remove a record by index from a `StrList`
+ * @param pStrList
+ * @param index
+ */
+void strlist_remove(StrList *pStrList, size_t index) {
+ size_t count = strlist_count(pStrList);
+ if (count == 0) {
+ return;
+ }
+
+ for (size_t i = index; i < count; i++) {
+ char *next = pStrList->data[i + 1];
+ pStrList->data[i] = next;
+ if (next == NULL) {
+ break;
+ }
+ }
+
+ pStrList->num_inuse--;
+}
+
+/**
* Compare two `StrList`s
* @param a `StrList` structure
* @param b `StrList` structure