Commit 95bd2b3e authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

strcase: make the tool use curl_str[n]equal instead

As they are after all part of the public API. Saves space and reduces
complexity. Remove the strcase defines from the curlx_ family.

Suggested-by: Dan Fandrich
Idea: https://curl.haxx.se/mail/lib-2016-10/0136.html
parent 10716809
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -73,8 +73,6 @@
*/

#define curlx_getenv curl_getenv
#define curlx_strcasecompare curl_strequal
#define curlx_strncasecompare curl_strnequal
#define curlx_mvsnprintf curl_mvsnprintf
#define curlx_msnprintf curl_msnprintf
#define curlx_maprintf curl_maprintf
+0 −2
Original line number Diff line number Diff line
@@ -11,14 +11,12 @@
# the official API, but we re-use the code here to avoid duplication.
CURLX_CFILES = \
	../lib/strtoofft.c \
	../lib/strcase.c \
	../lib/nonblock.c \
	../lib/warnless.c

CURLX_HFILES = \
	../lib/curl_setup.h \
	../lib/strtoofft.h \
	../lib/strcase.h \
	../lib/nonblock.h \
	../lib/warnless.h

+4 −4
Original line number Diff line number Diff line
@@ -416,10 +416,10 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
    }

    for(j = 0; j < sizeof(aliases)/sizeof(aliases[0]); j++) {
      if(curlx_strncasecompare(aliases[j].lname, word, fnam)) {
      if(curl_strnequal(aliases[j].lname, word, fnam)) {
        longopt = TRUE;
        numhits++;
        if(curlx_strcasecompare(aliases[j].lname, word)) {
        if(curl_strequal(aliases[j].lname, word)) {
          parse = aliases[j].letter;
          hit = j;
          numhits = 1; /* a single unique hit */
@@ -1343,7 +1343,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
        break;
      case 'f': /* crypto engine */
        GetStr(&config->engine, nextarg);
        if(config->engine && curlx_strcasecompare(config->engine, "list"))
        if(config->engine && curl_strequal(config->engine, "list"))
          return PARAM_ENGINES_REQUESTED;
        break;
      case 'g': /* CA info PEM file */
@@ -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(!strcasecompare(config->tls_authtype, "SRP"))
          if(!curl_strequal(config->tls_authtype, "SRP"))
            return PARAM_LIBCURL_DOESNT_SUPPORT; /* only support TLS-SRP */
        }
        else
+2 −2
Original line number Diff line number Diff line
@@ -104,11 +104,11 @@ void customrequest_helper(struct OperationConfig *config, HttpReq req,

  if(!method)
    ;
  else if(curlx_strcasecompare(method, dflt[req])) {
  else if(curl_strequal(method, dflt[req])) {
    notef(config->global, "Unnecessary use of -X or --request, %s is already "
          "inferred.\n", dflt[req]);
  }
  else if(curlx_strcasecompare(method, "head")) {
  else if(curl_strequal(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");
+2 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2014, 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
@@ -89,7 +89,7 @@ CURLcode get_libcurl_info(void)
  if(curlinfo->protocols) {
    for(proto = curlinfo->protocols; *proto; proto++) {
      for(p = possibly_built_in; p->proto_name; p++) {
        if(curlx_strcasecompare(*proto, p->proto_name)) {
        if(curl_strequal(*proto, p->proto_name)) {
          built_in_protos |= p->proto_pattern;
          break;
        }
Loading