gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated: mhd_str: minor optimization


From: gnunet
Subject: [libmicrohttpd] branch master updated: mhd_str: minor optimization
Date: Fri, 30 Apr 2021 16:15:44 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new edb98b9a mhd_str: minor optimization
edb98b9a is described below

commit edb98b9a34d404f9c22aa40628319c4b53865b84
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Apr 30 17:01:42 2021 +0300

    mhd_str: minor optimization
---
 src/microhttpd/mhd_str.c | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/src/microhttpd/mhd_str.c b/src/microhttpd/mhd_str.c
index 08162fb2..c0218bca 100644
--- a/src/microhttpd/mhd_str.c
+++ b/src/microhttpd/mhd_str.c
@@ -350,11 +350,16 @@ MHD_str_equal_caseless_ (const char *str1,
   {
     const char c1 = *str1;
     const char c2 = *str2;
-    if ( (c1 != c2) &&
-         (toasciilower (c1) != toasciilower (c2)) )
+    if ( (c1 == c2) ||
+         (isasciiupper (c1) ?
+          ((c1 - 'A' + 'a') == c2) :
+          (isasciiupper (c2) && (c1 == (c2 - 'A' + 'a')))) )
+    {
+      str1++;
+      str2++;
+    }
+    else
       return 0;
-    str1++;
-    str2++;
   }
   return 0 == (*str2);
 }
@@ -387,8 +392,12 @@ MHD_str_equal_caseless_n_ (const char *const str1,
     const char c2 = str2[i];
     if (0 == c2)
       return 0 == c1;
-    if ( (c1 != c2) &&
-         (toasciilower (c1) != toasciilower (c2)) )
+    if ( (c1 == c2) ||
+         (isasciiupper (c1) ?
+          ((c1 - 'A' + 'a') == c2) :
+          (isasciiupper (c2) && (c1 == (c2 - 'A' + 'a')))) )
+      continue;
+    else
       return 0;
   }
   return ! 0;
@@ -415,8 +424,12 @@ MHD_str_equal_caseless_bin_n_ (const char *const str1,
   {
     const char c1 = str1[i];
     const char c2 = str2[i];
-    if ( (c1 != c2) &&
-         (toasciilower (c1) != toasciilower (c2)) )
+    if ( (c1 == c2) ||
+         (isasciiupper (c1) ?
+          ((c1 - 'A' + 'a') == c2) :
+          (isasciiupper (c2) && (c1 == (c2 - 'A' + 'a')))) )
+      continue;
+    else
       return 0;
   }
   return ! 0;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]