]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: avoid using strlen for testing if a string is empty
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>
Mon, 3 Feb 2020 09:42:46 +0000 (11:42 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 4 Feb 2020 07:27:09 +0000 (08:27 +0100)
Closes #4873

src/tool_getparam.c
src/tool_operhlp.c

index b757ac8f04240ac6ead04f2d1506342513aa9d31..1a72edf3ee149682fe394d3599568a882c672a63 100644 (file)
@@ -422,7 +422,7 @@ void parse_cert_parameter(const char *cert_parameter,
       /* escaped colons and Windows drive letter colons were handled
        * above; if we're still here, this is a separating colon */
       param_place++;
-      if(strlen(param_place) > 0) {
+      if(*param_place) {
         *passphrase = strdup(param_place);
       }
       goto done;
index 8a9b7c9e8fd3557fec1669f7a726fc3dca213abc..7b9ff7d2aa9506de43cef1bdc1ad8df96117dd22 100644 (file)
@@ -85,7 +85,7 @@ char *add_file_name_to_url(char *url, const char *filename)
   else
     ptr = url;
   ptr = strrchr(ptr, '/');
-  if(!ptr || !strlen(++ptr)) {
+  if(!ptr || !*++ptr) {
     /* The URL has no file name part, add the local file name. In order
        to be able to do so, we have to create a new URL in another
        buffer.*/