curl_slist_free_all.md (1066B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: curl_slist_free_all 5 Section: 3 6 Source: libcurl 7 See-also: 8 - curl_slist_append (3) 9 Protocol: 10 - All 11 Added-in: 7.1 12 --- 13 14 # NAME 15 16 curl_slist_free_all - free an entire curl_slist list 17 18 # SYNOPSIS 19 20 ~~~c 21 #include <curl/curl.h> 22 23 void curl_slist_free_all(struct curl_slist *list); 24 ~~~ 25 26 # DESCRIPTION 27 28 curl_slist_free_all() removes all traces of a previously built curl_slist 29 linked list. 30 31 Passing in a NULL pointer in *list* makes this function return immediately 32 with no action. 33 34 Any use of the **list** after this function has been called and have returned, 35 is illegal. 36 37 # %PROTOCOLS% 38 39 # EXAMPLE 40 41 ~~~c 42 int main(void) 43 { 44 CURL *handle = curl_easy_init(); 45 struct curl_slist *slist = NULL; 46 47 slist = curl_slist_append(slist, "X-libcurl: coolness"); 48 49 if(!slist) 50 return -1; 51 52 curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist); 53 54 curl_easy_perform(handle); 55 56 curl_slist_free_all(slist); /* free the list again */ 57 } 58 ~~~ 59 60 # %AVAILABILITY% 61 62 # RETURN VALUE 63 64 Nothing.