Committing small pieces step by step because I've already lost everything once today *headbash* - stringlist search added, but not to main API. ENGINE-463
authorKrista Bennett <krista@pep-project.org>
Tue, 02 Oct 2018 13:16:19 +0200
branchENGINE-463
changeset 2963a80bc5f9167e
parent 2960 2e282c20ec11
child 2964 4f22b5bc7b9a
Committing small pieces step by step because I've already lost everything once today *headbash* - stringlist search added, but not to main API.
src/stringlist.c
src/stringlist.h
     1.1 --- a/src/stringlist.c	Fri Sep 28 19:21:40 2018 +0200
     1.2 +++ b/src/stringlist.c	Tue Oct 02 13:16:19 2018 +0200
     1.3 @@ -113,6 +113,17 @@
     1.4      return list_curr->next;
     1.5  }
     1.6  
     1.7 +stringlist_t* stringlist_search(stringlist_t* head, const char* value) {
     1.8 +    if (!head || !value || !head->value)
     1.9 +        return NULL;
    1.10 +    stringlist_t* retval = head;
    1.11 +    for (; retval ; retval = retval->next) {
    1.12 +        if (strcmp(retval->value, value) == 0))
    1.13 +            break;
    1.14 +    }
    1.15 +    return retval;
    1.16 +}
    1.17 +
    1.18  DYNAMIC_API stringlist_t *stringlist_add_unique(
    1.19          stringlist_t *stringlist,
    1.20          const char *value
     2.1 --- a/src/stringlist.h	Fri Sep 28 19:21:40 2018 +0200
     2.2 +++ b/src/stringlist.h	Tue Oct 02 13:16:19 2018 +0200
     2.3 @@ -133,6 +133,7 @@
     2.4  
     2.5  DYNAMIC_API void free_stringlist(stringlist_t *stringlist);
     2.6  
     2.7 +stringlist_t* stringlist_search(stringlist_t* head, const char* value);
     2.8  
     2.9  #ifdef __cplusplus
    2.10  }