diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-09-30 17:15:05 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-10-31 08:46:35 +0100 |
commit | 502acba2af821391b85a2cd4ac7b91ad8e9d4180 (patch) | |
tree | e219be1178db413bffd92033e965c1e1075c4702 /src | |
parent | 1833a45dde4d27febfce42813699533b1ae993d1 (diff) | |
download | curl-502acba2af821391b85a2cd4ac7b91ad8e9d4180.tar.gz |
strcasecompare: is the new name for strequal()
... to make it less likely that we forget that the function actually
does case insentive compares. Also replaced several invokes of the
function with a plain strcmp when case sensitivity is not an issue (like
comparing with "-").
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_cb_dbg.c | 6 | ||||
-rw-r--r-- | src/tool_getparam.c | 16 | ||||
-rw-r--r-- | src/tool_helpers.c | 6 | ||||
-rw-r--r-- | src/tool_operate.c | 14 | ||||
-rw-r--r-- | src/tool_operhlp.c | 6 | ||||
-rw-r--r-- | src/tool_writeout.c | 2 |
6 files changed, 25 insertions, 25 deletions
diff --git a/src/tool_cb_dbg.c b/src/tool_cb_dbg.c index 97a5c92d3..221eae67f 100644 --- a/src/tool_cb_dbg.c +++ b/src/tool_cb_dbg.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, 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 @@ -73,9 +73,9 @@ int tool_debug_cb(CURL *handle, curl_infotype type, if(!config->trace_stream) { /* open for append */ - if(curlx_strequal("-", config->trace_dump)) + if(!strcmp("-", config->trace_dump)) config->trace_stream = stdout; - else if(curlx_strequal("%", config->trace_dump)) + else if(!strcmp("%", config->trace_dump)) /* Ok, this is somewhat hackish but we do it undocumented for now */ config->trace_stream = config->errors; /* aka stderr */ else { diff --git a/src/tool_getparam.c b/src/tool_getparam.c index e49acf803..34983b94d 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -416,7 +416,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ } for(j = 0; j < sizeof(aliases)/sizeof(aliases[0]); j++) { - if(curlx_strnequal(aliases[j].lname, word, fnam)) { + if(curlx_strncasecompare(aliases[j].lname, word, fnam)) { longopt = TRUE; numhits++; if(curlx_raw_equal(aliases[j].lname, word)) { @@ -1109,7 +1109,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'C': /* This makes us continue an ftp transfer at given position */ - if(!curlx_strequal(nextarg, "-")) { + if(strcmp(nextarg, "-")) { err = str2offset(&config->resume_from, nextarg); if(err) return err; @@ -1153,7 +1153,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ } if('@' == is_file) { /* a '@' letter, it means that a file name or - (stdin) follows */ - if(curlx_strequal("-", p)) { + if(!strcmp("-", p)) { file = stdin; set_binmode(stdin); } @@ -1218,7 +1218,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ or - (stdin) follows */ nextarg++; /* pass the @ */ - if(curlx_strequal("-", nextarg)) { + if(!strcmp("-", nextarg)) { file = stdin; if(subletter == 'b') /* forced data-binary */ set_binmode(stdin); @@ -1377,7 +1377,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ case 'm': /* TLS authentication type */ if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP) { GetStr(&config->tls_authtype, nextarg); - if(!strequal(config->tls_authtype, "SRP")) + if(!strcasecompare(config->tls_authtype, "SRP")) return PARAM_LIBCURL_DOESNT_SUPPORT; /* only support TLS-SRP */ } else @@ -1770,7 +1770,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ FILE *file; const char *fname; nextarg++; /* pass the @ */ - if(curlx_strequal("-", nextarg)) { + if(!strcmp("-", nextarg)) { fname = "<stdin>"; file = stdin; } @@ -1880,7 +1880,7 @@ ParameterError parse_args(struct GlobalConfig *config, int argc, bool passarg; char *flag = argv[i]; - if(curlx_strequal("--", argv[i])) + if(!strcmp("--", argv[i])) /* This indicates the end of the flags and thus enables the following (URL) argument to start with -. */ stillflags = FALSE; @@ -1936,7 +1936,7 @@ ParameterError parse_args(struct GlobalConfig *config, int argc, result != PARAM_ENGINES_REQUESTED) { const char *reason = param2text(result); - if(orig_opt && !curlx_strequal(":", orig_opt)) + if(orig_opt && strcmp(":", orig_opt)) helpf(config->errors, "option %s: %s\n", orig_opt, reason); else helpf(config->errors, "%s\n", reason); diff --git a/src/tool_helpers.c b/src/tool_helpers.c index 14bc7668c..bfba3dcc1 100644 --- a/src/tool_helpers.c +++ b/src/tool_helpers.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, 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 @@ -104,11 +104,11 @@ void customrequest_helper(struct OperationConfig *config, HttpReq req, if(!method) ; - else if(curl_strequal(method, dflt[req])) { + else if(curlx_strcasecompare(method, dflt[req])) { notef(config->global, "Unnecessary use of -X or --request, %s is already " "inferred.\n", dflt[req]); } - else if(curl_strequal(method, "head")) { + else if(curlx_strcasecompare(method, "head")) { warnf(config->global, "Setting custom HTTP method to HEAD with -X/--request may not work " "the way you want. Consider using -I/--head instead.\n"); diff --git a/src/tool_operate.c b/src/tool_operate.c index 88427ce4c..c8bc80a6a 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -321,7 +321,7 @@ static CURLcode operate_do(struct GlobalConfig *global, /* Single header file for all URLs */ if(config->headerfile) { /* open file for output: */ - if(!curlx_strequal(config->headerfile, "-")) { + if(strcmp(config->headerfile, "-")) { FILE *newfile = fopen(config->headerfile, "wb"); if(!newfile) { warnf(config->global, "Failed to open %s\n", config->headerfile); @@ -464,7 +464,7 @@ static CURLcode operate_do(struct GlobalConfig *global, urlnum = 1; /* without globbing, this is a single URL */ /* if multiple files extracted to stdout, insert separators! */ - separator= ((!outfiles || curlx_strequal(outfiles, "-")) && urlnum > 1); + separator= ((!outfiles || !strcmp(outfiles, "-")) && urlnum > 1); /* Here's looping around each globbed URL */ for(li = 0 ; li < urlnum; li++) { @@ -534,7 +534,7 @@ static CURLcode operate_do(struct GlobalConfig *global, } if(((urlnode->flags&GETOUT_USEREMOTE) || - (outfile && !curlx_strequal("-", outfile))) && + (outfile && strcmp("-", outfile))) && (metalink || !config->use_metalink)) { /* @@ -715,7 +715,7 @@ static CURLcode operate_do(struct GlobalConfig *global, DEBUGASSERT(infd == STDIN_FILENO); set_binmode(stdin); - if(curlx_strequal(uploadfile, ".")) { + if(!strcmp(uploadfile, ".")) { if(curlx_nonblock((curl_socket_t)infd, TRUE) < 0) warnf(config->global, "fcntl failed on fd=%d: %s\n", infd, strerror(errno)); @@ -1559,7 +1559,7 @@ static CURLcode operate_do(struct GlobalConfig *global, char *effective_url = NULL; curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective_url); if(effective_url && - curlx_strnequal(effective_url, "http", 4)) { + curlx_strncasecompare(effective_url, "http", 4)) { /* This was HTTP(S) */ curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response); if(response != 200 && response != 206) { @@ -1842,8 +1842,8 @@ CURLcode operate(struct GlobalConfig *config, int argc, argv_item_t argv[]) /* Parse .curlrc if necessary */ if((argc == 1) || - (!curlx_strequal(argv[1], "-q") && - !curlx_strequal(argv[1], "--disable"))) { + (!curlx_strcasecompare(argv[1], "-q") && + !curlx_strcasecompare(argv[1], "--disable"))) { parseconfig(NULL, config); /* ignore possible failure */ /* If we had no arguments then make sure a url was specified in .curlrc */ diff --git a/src/tool_operhlp.c b/src/tool_operhlp.c index b43dc9548..1c0d302ab 100644 --- a/src/tool_operhlp.c +++ b/src/tool_operhlp.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2014, 2016, 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 @@ -63,8 +63,8 @@ bool output_expected(const char *url, const char *uploadfile) bool stdin_upload(const char *uploadfile) { - return (curlx_strequal(uploadfile, "-") || - curlx_strequal(uploadfile, ".")) ? TRUE : FALSE; + return (!strcmp(uploadfile, "-") || + !strcmp(uploadfile, ".")) ? TRUE : FALSE; } /* diff --git a/src/tool_writeout.c b/src/tool_writeout.c index 6e94afe42..8b709cbe3 100644 --- a/src/tool_writeout.c +++ b/src/tool_writeout.c @@ -126,7 +126,7 @@ void ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo) keepit = *end; *end = 0; /* zero terminate */ for(i = 0; replacements[i].name; i++) { - if(curl_strequal(ptr, replacements[i].name)) { + if(curl_strcasecompare(ptr, replacements[i].name)) { match = TRUE; switch(replacements[i].id) { case VAR_EFFECTIVE_URL: |