diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-01-22 09:26:39 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-01-22 09:26:39 -0500 |
commit | 74ddda664b9d7e843da3ec8254716c11016007e5 (patch) | |
tree | 5a284a80aaa4fd770d92307a740672987aa0cabe /src/strings.c | |
parent | 444ccb0a7c5f88f408bee91db052d00794791ccc (diff) | |
download | spmc-74ddda664b9d7e843da3ec8254716c11016007e5.tar.gz |
Change fstree signature
Change strstr_array return type to char*
Re-add and reorder a few prototypes in spm.h
Diffstat (limited to 'src/strings.c')
-rw-r--r-- | src/strings.c | 12 |
1 files changed, 6 insertions, 6 deletions
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; } /** |