[common] stringlist: implement item removal

This commit is contained in:
Quantum 2021-08-28 18:22:11 -04:00 committed by Geoffrey McRae
parent f0beedb5ba
commit e11246d46e
2 changed files with 11 additions and 5 deletions

View file

@ -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

View file

@ -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);