]> granicus.if.org Git - curl/commitdiff
tool_main: Moved config struct initialisation into a separate function
authorSteve Holme <steve_holme@hotmail.com>
Sat, 1 Feb 2014 13:26:09 +0000 (13:26 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Sat, 1 Feb 2014 13:44:00 +0000 (13:44 +0000)
In preparation for adding URL specific options moved the initialisation
of the Configurable structure into a separate function in tool_cfgable.

src/tool_cfgable.c
src/tool_cfgable.h
src/tool_main.c

index f9fd55283e3fcb2ff167448d59cbe9d143d80619..5ee46871c97e6d567577de97f75fbae8bb9866dc 100644 (file)
@@ -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
 
 #include "memdebug.h" /* keep this as LAST include */
 
+void init_config(struct Configurable* config)
+{
+  memset(config, 0, sizeof(struct Configurable));
+
+  config->errors = stderr; /* default errors to stderr */
+}
+
 void free_config_fields(struct Configurable *config)
 {
   struct getout *urlnode;
index c1687328df93793598494d9d15e4de2b24da704d..fa4ec7ec02cf557eaaedf4eaecab57c157d48b56 100644 (file)
@@ -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
@@ -216,6 +216,7 @@ struct Configurable {
   char *xoauth2_bearer;     /* XOAUTH2 bearer token */
 }; /* struct Configurable */
 
+void init_config(struct Configurable* config);
 void free_config_fields(struct Configurable *config);
 
 #endif /* HEADER_CURL_TOOL_CFGABLE_H */
index 8f2fbb77b2d5f9b608e7ef485b0fa6f4558d8406..fe0768747f2fd50922f2bc6e068829b3dd201d83 100644 (file)
@@ -5,7 +5,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
@@ -90,9 +90,8 @@ int main(int argc, char *argv[])
   int res;
   struct Configurable config;
 
-  memset(&config, 0, sizeof(struct Configurable));
-
-  config.errors = stderr; /* default errors to stderr */
+  /* Initialise the config */
+  init_config(&config);
 
   main_checkfds();