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