/***************************************************************************1* _ _ ____ _2* Project ___| | | | _ \| |3* / __| | | | |_) | |4* | (__| |_| | _ <| |___5* \___|\___/|_| \_\_____|6*7* Copyright (C) Daniel Stenberg, <[email protected]>, et al.8*9* This software is licensed as described in the file COPYING, which10* you should have received as part of this distribution. The terms11* are also available at https://curl.se/docs/copyright.html.12*13* You may opt to use, copy, modify, merge, publish, distribute and/or sell14* copies of the Software, and permit persons to whom the Software is15* furnished to do so, under the terms of the COPYING file.16*17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY18* KIND, either express or implied.19*20* SPDX-License-Identifier: curl21*22***************************************************************************/2324#include "tool_setup.h"2526#ifndef CURL_DISABLE_LIBCURL_OPTION2728#include "slist_wc.h"2930/* The last #include files should be: */31#include <memdebug.h>3233/*34* slist_wc_append() appends a string to the linked list. This function can be35* used as an initialization function as well as an append function.36*/37struct slist_wc *slist_wc_append(struct slist_wc *list,38const char *data)39{40struct curl_slist *new_item = curl_slist_append(NULL, data);4142if(!new_item)43return NULL;4445if(!list) {46list = malloc(sizeof(struct slist_wc));4748if(!list) {49curl_slist_free_all(new_item);50return NULL;51}5253list->first = new_item;54list->last = new_item;55return list;56}5758list->last->next = new_item;59list->last = list->last->next;60return list;61}6263/* be nice and clean up resources */64void slist_wc_free_all(struct slist_wc *list)65{66if(!list)67return;6869curl_slist_free_all(list->first);70free(list);71}7273#endif /* CURL_DISABLE_LIBCURL_OPTION */747576