From 0fc9545546cd6cff95ef32e043efbcbbf89ca89b Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Sat, 12 Oct 2013 13:32:04 -0400 Subject: pacman/util: remove strsplit strsplit was used in only one place and did the same thing as strtok. Signed-off-by: Andrew Gregory Signed-off-by: Allan McRae --- src/pacman/util.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) (limited to 'src/pacman/util.c') diff --git a/src/pacman/util.c b/src/pacman/util.c index 6da1cd40..0e9a4200 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -378,40 +378,6 @@ char *strreplace(const char *str, const char *needle, const char *replace) return newstr; } -/** Splits a string into a list of strings using the chosen character as - * a delimiter. - * - * @param str the string to split - * @param splitchar the character to split at - * - * @return a list containing the duplicated strings - */ -alpm_list_t *strsplit(const char *str, const char splitchar) -{ - alpm_list_t *list = NULL; - const char *prev = str; - char *dup = NULL; - - while((str = strchr(str, splitchar))) { - dup = strndup(prev, (size_t)(str - prev)); - if(dup == NULL) { - return NULL; - } - list = alpm_list_add(list, dup); - - str++; - prev = str; - } - - dup = strdup(prev); - if(dup == NULL) { - return NULL; - } - list = alpm_list_add(list, dup); - - return list; -} - static size_t string_length(const char *s) { int len; -- cgit v1.2.3-24-g4f1b