From e11246d46e8666969cc85775a78155bb44b7ea01 Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 28 Aug 2021 18:22:11 -0400 Subject: [PATCH] [common] stringlist: implement item removal --- common/include/common/stringlist.h | 11 ++++++----- common/src/stringlist.c | 5 +++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/common/include/common/stringlist.h b/common/include/common/stringlist.h index 89cb0bcb..556ea437 100644 --- a/common/include/common/stringlist.h +++ b/common/include/common/stringlist.h @@ -25,10 +25,11 @@ typedef struct StringList * StringList; -StringList stringlist_new (bool owns_strings); -void stringlist_free (StringList * sl); -int stringlist_push (StringList sl, char * str); -unsigned int stringlist_count(StringList sl); -char * stringlist_at (StringList sl, unsigned int index); +StringList stringlist_new (bool owns_strings); +void stringlist_free (StringList * sl); +int stringlist_push (StringList sl, char * str); +void stringlist_remove(StringList sl, unsigned int index); +unsigned int stringlist_count (StringList sl); +char * stringlist_at (StringList sl, unsigned int index); #endif diff --git a/common/src/stringlist.c b/common/src/stringlist.c index e50c6424..bbf0ef44 100644 --- a/common/src/stringlist.c +++ b/common/src/stringlist.c @@ -63,6 +63,11 @@ int stringlist_push(StringList sl, char * str) return index; } +void stringlist_remove(StringList sl, unsigned int index) +{ + vector_remove(&sl->vector, index); +} + unsigned int stringlist_count(StringList sl) { return vector_size(&sl->vector);