curl tool: create tool_myfunc.[ch] which later on will hold my_* functions
[platform/upstream/curl.git] / src / tool_cfgable.c
1 /***************************************************************************
2  *                                  _   _ ____  _
3  *  Project                     ___| | | |  _ \| |
4  *                             / __| | | | |_) | |
5  *                            | (__| |_| |  _ <| |___
6  *                             \___|\___/|_| \_\_____|
7  *
8  * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
9  *
10  * This software is licensed as described in the file COPYING, which
11  * you should have received as part of this distribution. The terms
12  * are also available at http://curl.haxx.se/docs/copyright.html.
13  *
14  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15  * copies of the Software, and permit persons to whom the Software is
16  * furnished to do so, under the terms of the COPYING file.
17  *
18  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19  * KIND, either express or implied.
20  *
21  ***************************************************************************/
22 #include "setup.h"
23
24 #include <curl/curl.h>
25
26 #include "tool_cfgable.h"
27
28 #include "memdebug.h" /* keep this as LAST include */
29
30 /* TODO: review handling of unhandled fields marked below */
31
32 void free_config_fields(struct Configurable *config)
33 {
34   if(config->easy) {
35     curl_easy_cleanup(config->easy);
36     config->easy = NULL;
37   }
38
39   Curl_safefree(config->random_file);
40   Curl_safefree(config->egd_file);
41   Curl_safefree(config->useragent);
42   Curl_safefree(config->cookie);
43   Curl_safefree(config->cookiejar);
44   Curl_safefree(config->cookiefile);
45
46   Curl_safefree(config->postfields);
47   Curl_safefree(config->referer);
48
49   Curl_safefree(config->headerfile);
50   Curl_safefree(config->ftpport);
51   Curl_safefree(config->iface);
52
53   Curl_safefree(config->range);
54
55   Curl_safefree(config->userpwd);
56   Curl_safefree(config->tls_username);
57   Curl_safefree(config->tls_password);
58   Curl_safefree(config->tls_authtype);
59   Curl_safefree(config->proxyuserpwd);
60   Curl_safefree(config->proxy);
61
62   Curl_safefree(config->noproxy);
63   Curl_safefree(config->mail_from);
64   curl_slist_free_all(config->mail_rcpt);
65
66   Curl_safefree(config->netrc_file);
67
68   /* config->url_list not handled */
69   /* config->url_last not handled */
70   /* config->url_get not handled */
71   /* config->url_out not handled */
72
73   Curl_safefree(config->cipher_list);
74   Curl_safefree(config->cert);
75   Curl_safefree(config->cert_type);
76   Curl_safefree(config->cacert);
77   Curl_safefree(config->capath);
78   Curl_safefree(config->crlfile);
79   Curl_safefree(config->key);
80   Curl_safefree(config->key_type);
81   Curl_safefree(config->key_passwd);
82   Curl_safefree(config->pubkey);
83   Curl_safefree(config->hostpubmd5);
84
85   /* config->engine not handled */
86
87   Curl_safefree(config->customrequest);
88   Curl_safefree(config->krblevel);
89   Curl_safefree(config->trace_dump);
90
91   /* config->trace_stream not handled */
92
93   Curl_safefree(config->writeout);
94
95   /* config->errors not handled */
96
97   curl_slist_free_all(config->quote);
98   curl_slist_free_all(config->postquote);
99   curl_slist_free_all(config->prequote);
100
101   curl_slist_free_all(config->headers);
102
103   if(config->httppost) {
104     curl_formfree(config->httppost);
105     config->httppost = NULL;
106   }
107
108   /* config->last_post not handled */
109
110   curl_slist_free_all(config->telnet_options);
111   curl_slist_free_all(config->resolve);
112
113   Curl_safefree(config->socksproxy);
114   Curl_safefree(config->socks5_gssapi_service);
115
116   Curl_safefree(config->ftp_account);
117   Curl_safefree(config->ftp_alternative_to_user);
118
119   Curl_safefree(config->libcurl);
120
121   /* config->outs not handled */
122
123 }
124