From 74ddda664b9d7e843da3ec8254716c11016007e5 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 22 Jan 2020 09:26:39 -0500 Subject: Change fstree signature Change strstr_array return type to char* Re-add and reorder a few prototypes in spm.h --- src/strings.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/strings.c') diff --git a/src/strings.c b/src/strings.c index 0dc9c47..46ef9ea 100644 --- a/src/strings.c +++ b/src/strings.c @@ -368,19 +368,19 @@ void strsortlen(char **arr, unsigned int sort_mode) { * Search for string in an array of strings * @param arr array of strings * @param str string to search for - * @return yes=0, no=1, failure=-1 + * @return yes=`pointer to string`, no=`NULL`, failure=`NULL` */ -int strstr_array(char **arr, const char *str) { - if (!arr) { - return -1; +char *strstr_array(char **arr, const char *str) { + if (arr == NULL) { + return NULL; } for (int i = 0; arr[i] != NULL; i++) { if (strstr(arr[i], str) != NULL) { - return 0; + return arr[i]; } } - return 1; + return NULL; } /** -- cgit