aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-06 19:50:47 +0100
committerMax Kellermann <max@duempel.org>2009-11-06 19:50:47 +0100
commitf9218423b90a8effafba323abb088cebba34fb25 (patch)
tree994e8c48dd6bca294cca60398c49d27b7e4abb54 /src/utils.c
parentba34d48cf093cbfbe9d6e63e7177ba79791c6a4a (diff)
downloadmpd-f9218423b90a8effafba323abb088cebba34fb25.tar.gz
mpd-f9218423b90a8effafba323abb088cebba34fb25.tar.xz
mpd-f9218423b90a8effafba323abb088cebba34fb25.zip
utils: renamed stringFoundInStringArray()
No CamelCase. Use bool instead of int. Make both arguments mandatory.
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/utils.c b/src/utils.c
index 933a70a8c..ed8ef6c1a 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -132,13 +132,15 @@ int set_nonblocking(int fd)
#endif
}
-int stringFoundInStringArray(const char *const*array, const char *suffix)
+bool
+string_array_contains(const char *const* haystack, const char *needle)
{
- while (array && *array) {
- if (g_ascii_strcasecmp(*array, suffix) == 0)
- return 1;
- array++;
- }
+ assert(haystack != NULL);
+ assert(needle != NULL);
+
+ for (; *haystack != NULL; ++haystack)
+ if (g_ascii_strcasecmp(*haystack, needle) == 0)
+ return true;
- return 0;
+ return false;
}