Skip to content

Commit

Permalink
tool_cfgable: Renamed Configurable structure to OperationConfig
Browse files Browse the repository at this point in the history
To allow for the addition of a global config structure and prevent
confusion between the two.
  • Loading branch information
captain-caveman2k committed Feb 23, 2014
1 parent 6512e93 commit 705a4cb
Show file tree
Hide file tree
Showing 32 changed files with 99 additions and 103 deletions.
4 changes: 2 additions & 2 deletions src/tool_cb_dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -44,7 +44,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
unsigned char *data, size_t size,
void *userdata)
{
struct Configurable *config = userdata;
struct OperationConfig *config = userdata;
FILE *output = config->errors;
const char *text;
struct timeval tv;
Expand Down
3 changes: 1 addition & 2 deletions src/tool_cb_prg.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ int tool_progress_cb(void *clientp,
}

void progressbarinit(struct ProgressData *bar,
struct Configurable *config)
struct OperationConfig *config)
{
#ifdef __EMX__
/* 20000318 mgs */
Expand Down Expand Up @@ -148,4 +148,3 @@ void progressbarinit(struct ProgressData *bar,

bar->out = config->errors;
}

4 changes: 2 additions & 2 deletions src/tool_cb_prg.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -36,7 +36,7 @@ struct ProgressData {
};

void progressbarinit(struct ProgressData *bar,
struct Configurable *config);
struct OperationConfig *config);

/*
** callback for CURLOPT_PROGRESSFUNCTION
Expand Down
4 changes: 2 additions & 2 deletions src/tool_cb_wrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -39,7 +39,7 @@ size_t tool_write_cb(void *buffer, size_t sz, size_t nmemb, void *userdata)
{
size_t rc;
struct OutStruct *outs = userdata;
struct Configurable *config = outs->config;
struct OperationConfig *config = outs->config;

/*
* Once that libcurl has called back tool_write_cb() the returned value
Expand Down
12 changes: 6 additions & 6 deletions src/tool_cfgable.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

#include "memdebug.h" /* keep this as LAST include */

void config_init(struct Configurable* config)
void config_init(struct OperationConfig* config)
{
memset(config, 0, sizeof(struct Configurable));
memset(config, 0, sizeof(struct OperationConfig));

config->errors = stderr; /* default errors to stderr */
config->postfieldsize = -1;
Expand All @@ -43,7 +43,7 @@ void config_init(struct Configurable* config)
config->proto_redir_present = FALSE;
}

static void free_config_fields(struct Configurable *config)
static void free_config_fields(struct OperationConfig *config)
{
struct getout *urlnode;

Expand Down Expand Up @@ -150,17 +150,17 @@ static void free_config_fields(struct Configurable *config)
Curl_safefree(config->libcurl);
}

void config_free(struct Configurable *config)
void config_free(struct OperationConfig *config)
{
struct Configurable *last = config;
struct OperationConfig *last = config;

/* Find the last config structure */
while(last->next)
last = last->next;

/* Free each of the structures in reverse order */
do {
struct Configurable *prev = last->prev;
struct OperationConfig *prev = last->prev;
if(prev)
last->easy = NULL;

Expand Down
10 changes: 5 additions & 5 deletions src/tool_cfgable.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include "tool_metalink.h"

struct Configurable {
struct OperationConfig {
CURL *easy; /* once we have one, we keep it here */
bool remote_time;
char *random_file;
Expand Down Expand Up @@ -216,11 +216,11 @@ struct Configurable {
bool nonpn; /* enable/disable TLS NPN extension */
bool noalpn; /* enable/disable TLS ALPN extension */

struct Configurable* prev;
struct Configurable* next; /* Always last in the struct */
struct OperationConfig* prev;
struct OperationConfig* next; /* Always last in the struct */
};

void config_init(struct Configurable* config);
void config_free(struct Configurable* config);
void config_init(struct OperationConfig* config);
void config_free(struct OperationConfig* config);

#endif /* HEADER_CURL_TOOL_CFGABLE_H */
6 changes: 3 additions & 3 deletions src/tool_doswin.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -262,7 +262,8 @@ char **__crt0_glob_function(char *arg)
* HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SafeProcessSearchMode
*/

CURLcode FindWin32CACert(struct Configurable *config, const char *bundle_file)
CURLcode FindWin32CACert(struct OperationConfig *config,
const char *bundle_file)
{
CURLcode result = CURLE_OK;

Expand Down Expand Up @@ -296,4 +297,3 @@ CURLcode FindWin32CACert(struct Configurable *config, const char *bundle_file)
#endif /* WIN32 */

#endif /* MSDOS || WIN32 */

4 changes: 2 additions & 2 deletions src/tool_doswin.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -35,7 +35,7 @@ char **__crt0_glob_function(char *arg);

#ifdef WIN32

CURLcode FindWin32CACert(struct Configurable *config, const char *bundle_file);
CURLcode FindWin32CACert(struct OperationConfig *config, const char *bundle_file);

#endif /* WIN32 */

Expand Down
4 changes: 2 additions & 2 deletions src/tool_easysrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -165,7 +165,7 @@ CURLcode easysrc_cleanup(void)
return CURLE_OK;
}

void dumpeasysrc(struct Configurable *config)
void dumpeasysrc(struct OperationConfig *config)
{
struct curl_slist *ptr;
char *o = config->libcurl;
Expand Down
4 changes: 2 additions & 2 deletions src/tool_easysrc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -40,7 +40,7 @@ extern CURLcode easysrc_add(struct curl_slist **plist, const char *bupf);
extern CURLcode easysrc_addf(struct curl_slist **plist, const char *fmt, ...);
extern CURLcode easysrc_perform(void);
extern CURLcode easysrc_cleanup(void);
void dumpeasysrc(struct Configurable *config);
void dumpeasysrc(struct OperationConfig *config);

#endif /* CURL_DISABLE_LIBCURL_OPTION */

Expand Down
2 changes: 1 addition & 1 deletion src/tool_formparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ static char *get_param_word(char **str, char **end_pos)
*
***************************************************************************/

int formparse(struct Configurable *config,
int formparse(struct OperationConfig *config,
const char *input,
struct curl_httppost **httppost,
struct curl_httppost **last_post,
Expand Down
4 changes: 2 additions & 2 deletions src/tool_formparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand All @@ -23,7 +23,7 @@
***************************************************************************/
#include "tool_setup.h"

int formparse(struct Configurable *config,
int formparse(struct OperationConfig *config,
const char *input,
struct curl_httppost **httppost,
struct curl_httppost **last_post,
Expand Down
6 changes: 3 additions & 3 deletions src/tool_getparam.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
char *nextarg, /* NULL if unset */
bool *usedarg, /* set to TRUE if the arg
has been used */
struct Configurable *config)
struct OperationConfig *config)
{
char letter;
char subletter = '\0'; /* subletters can only occur on long options */
Expand Down Expand Up @@ -1798,7 +1798,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
return PARAM_OK;
}

ParameterError parse_args(struct Configurable *config, int argc,
ParameterError parse_args(struct OperationConfig *config, int argc,
argv_item_t argv[])
{
int i;
Expand All @@ -1813,7 +1813,7 @@ ParameterError parse_args(struct Configurable *config, int argc,
(config->url_list && config->url_list->url)) {

/* Allocate the next config */
config->next = malloc(sizeof(struct Configurable));
config->next = malloc(sizeof(struct OperationConfig));
if(config->next) {
/* Initialise the newly created config */
config_init(config->next);
Expand Down
6 changes: 3 additions & 3 deletions src/tool_getparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@ typedef enum {
PARAM_LAST
} ParameterError;

struct Configurable;
struct OperationConfig;

ParameterError getparameter(char *flag,
char *nextarg,
bool *usedarg,
struct Configurable *config);
struct OperationConfig *config);

#ifdef UNITTESTS
void parse_cert_parameter(const char *cert_parameter,
char **certname,
char **passphrase);
#endif

ParameterError parse_args(struct Configurable *config, int argc,
ParameterError parse_args(struct OperationConfig *config, int argc,
argv_item_t argv[]);

#endif /* HEADER_CURL_TOOL_GETPARAM_H */
Expand Down
5 changes: 2 additions & 3 deletions src/tool_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand Down Expand Up @@ -65,7 +65,7 @@ const char *param2text(int res)
}
}

int SetHTTPrequest(struct Configurable *config, HttpReq req, HttpReq *store)
int SetHTTPrequest(struct OperationConfig *config, HttpReq req, HttpReq *store)
{
if((*store == HTTPREQ_UNSPEC) ||
(*store == req)) {
Expand All @@ -75,4 +75,3 @@ int SetHTTPrequest(struct Configurable *config, HttpReq req, HttpReq *store)
warnf(config, "You can only select one HTTP request!\n");
return 1;
}

4 changes: 2 additions & 2 deletions src/tool_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand All @@ -25,7 +25,7 @@

const char *param2text(int res);

int SetHTTPrequest(struct Configurable *config, HttpReq req, HttpReq *store);
int SetHTTPrequest(struct OperationConfig *config, HttpReq req, HttpReq *store);

#endif /* HEADER_CURL_TOOL_HELPERS_H */

6 changes: 3 additions & 3 deletions src/tool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static void memory_tracking_init(void)
* _any_ libcurl usage. If this fails, *NO* libcurl functions may be
* used, or havoc may be the result.
*/
static CURLcode main_init(struct Configurable *config)
static CURLcode main_init(struct OperationConfig *config)
{
CURLcode result = CURLE_OK;

Expand Down Expand Up @@ -162,7 +162,7 @@ static void main_free(void)
int main(int argc, char *argv[])
{
CURLcode result = CURLE_OK;
struct Configurable *config;
struct OperationConfig *config;

main_checkfds();

Expand All @@ -174,7 +174,7 @@ int main(int argc, char *argv[])
memory_tracking_init();

/* Allocate the initial config */
config = malloc(sizeof(struct Configurable));
config = malloc(sizeof(struct OperationConfig));

if(config) {
/* Initialise the config */
Expand Down
Loading

0 comments on commit 705a4cb

Please sign in to comment.