Move simple_string_list_size() into pgut.c, with the rest of these string functions.

Also, fix an error with this function not actually using its string_list argument.
This commit is contained in:
Josh Kupershmidt
2012-11-14 19:02:31 -07:00
committed by Daniele Varrazzo
parent 40626769d8
commit decd822393
3 changed files with 16 additions and 16 deletions

View File

@ -417,6 +417,21 @@ simple_string_list_member(SimpleStringList *list, const char *val)
return false;
}
/* Returns the number of elements in the given SimpleStringList */
size_t
simple_string_list_size(SimpleStringList string_list)
{
size_t i = 0;
SimpleStringListCell *cell = string_list.head;
while (cell)
{
cell = cell->next;
i++;
}
return i;
}
static char *
prompt_for_password(void)

View File

@ -186,6 +186,7 @@ typedef struct SimpleStringList
extern void simple_string_list_append(SimpleStringList *list, const char *val);
extern bool simple_string_list_member(SimpleStringList *list, const char *val);
extern size_t simple_string_list_size(SimpleStringList string_list);
/*