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