1 /* vi: set sw=4 ts=4: */
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 /* returns the array index of the string */
9 /* (index of first match is returned, or -1) */
10 int FAST_FUNC index_in_str_array(const char *const string_array[], const char *key)
14 for (i = 0; string_array[i] != 0; i++) {
15 if (strcmp(string_array[i], key) == 0) {
22 int FAST_FUNC index_in_strings(const char *strings, const char *key)
27 if (strcmp(strings, key) == 0) {
30 strings += strlen(strings) + 1; /* skip NUL */
36 /* returns the array index of the string, even if it matches only a beginning */
37 /* (index of first match is returned, or -1) */
39 int FAST_FUNC index_in_substr_array(const char *const string_array[], const char *key)
42 int len = strlen(key);
44 for (i = 0; string_array[i] != 0; i++) {
45 if (strncmp(string_array[i], key, len) == 0) {
54 int FAST_FUNC index_in_substrings(const char *strings, const char *key)
56 int len = strlen(key);
61 if (strncmp(strings, key, len) == 0) {
64 strings += strlen(strings) + 1; /* skip NUL */
71 const char* FAST_FUNC nth_string(const char *strings, int n)
75 strings += strlen(strings) + 1;