aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Hwang <danielleehwang@gmail.com>2015-09-21 21:06:42 -0700
committerDaniel Stenberg <daniel@haxx.se>2015-09-22 17:06:28 +0200
commit1467dec14710b4939a2191fea5f75c872a25f2ed (patch)
treed49d8ac6fe9119f629a3683b65c2e19d174ce250 /src
parent0583ed3e48be3fcbccf77dc5ac571ba442d203cb (diff)
tool: remove redundant libcurl check
The easysrc generation is run only when --libcurl is initialized. Ref: https://github.com/bagder/curl/issues/429 Closes #448
Diffstat (limited to 'src')
-rw-r--r--src/tool_easysrc.c80
1 files changed, 39 insertions, 41 deletions
diff --git a/src/tool_easysrc.c b/src/tool_easysrc.c
index 0482ef6ae..59e471dc5 100644
--- a/src/tool_easysrc.c
+++ b/src/tool_easysrc.c
@@ -172,55 +172,53 @@ void dumpeasysrc(struct GlobalConfig *config)
struct curl_slist *ptr;
char *o = config->libcurl;
- if(o) {
- FILE *out;
- bool fopened = FALSE;
- if(strcmp(o, "-")) {
- out = fopen(o, FOPEN_WRITETEXT);
- fopened = TRUE;
- }
- else
- out = stdout;
- if(!out)
- warnf(config, "Failed to open %s to write libcurl code!\n", o);
- else {
- int i;
- const char *c;
-
- for(i=0; ((c = srchead[i]) != NULL); i++)
- fprintf(out, "%s\n", c);
-
- /* Declare variables used for complex setopt values */
- for(ptr=easysrc_decl; ptr; ptr = ptr->next)
- fprintf(out, " %s\n", ptr->data);
+ FILE *out;
+ bool fopened = FALSE;
+ if(strcmp(o, "-")) {
+ out = fopen(o, FOPEN_WRITETEXT);
+ fopened = TRUE;
+ }
+ else
+ out = stdout;
+ if(!out)
+ warnf(config, "Failed to open %s to write libcurl code!\n", o);
+ else {
+ int i;
+ const char *c;
- /* Set up complex values for setopt calls */
- if(easysrc_data) {
- fprintf(out, "\n");
+ for(i=0; ((c = srchead[i]) != NULL); i++)
+ fprintf(out, "%s\n", c);
- for(ptr=easysrc_data; ptr; ptr = ptr->next)
- fprintf(out, " %s\n", ptr->data);
- }
+ /* Declare variables used for complex setopt values */
+ for(ptr=easysrc_decl; ptr; ptr = ptr->next)
+ fprintf(out, " %s\n", ptr->data);
+ /* Set up complex values for setopt calls */
+ if(easysrc_data) {
fprintf(out, "\n");
- for(ptr=easysrc_code; ptr; ptr = ptr->next) {
- if(ptr->data[0]) {
- fprintf(out, " %s\n", ptr->data);
- }
- else {
- fprintf(out, "\n");
- }
- }
- for(ptr=easysrc_clean; ptr; ptr = ptr->next)
+ for(ptr=easysrc_data; ptr; ptr = ptr->next)
fprintf(out, " %s\n", ptr->data);
+ }
- for(i=0; ((c = srcend[i]) != NULL); i++)
- fprintf(out, "%s\n", c);
-
- if(fopened)
- fclose(out);
+ fprintf(out, "\n");
+ for(ptr=easysrc_code; ptr; ptr = ptr->next) {
+ if(ptr->data[0]) {
+ fprintf(out, " %s\n", ptr->data);
+ }
+ else {
+ fprintf(out, "\n");
+ }
}
+
+ for(ptr=easysrc_clean; ptr; ptr = ptr->next)
+ fprintf(out, " %s\n", ptr->data);
+
+ for(i=0; ((c = srcend[i]) != NULL); i++)
+ fprintf(out, "%s\n", c);
+
+ if(fopened)
+ fclose(out);
}
easysrc_free();