aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/curl/lib/strcase.c
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2022-12-02 16:18:16 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2022-12-02 16:18:16 +0300
commit22a73deb46c33ab8539b522286f0fb9b3364f856 (patch)
treeaf3cf69e9e6ebc887a5add5491b2fcebbfdff06a /contrib/libs/curl/lib/strcase.c
parent2e7d246d83a0077f08e6fed36594fc2087949502 (diff)
downloadydb-22a73deb46c33ab8539b522286f0fb9b3364f856.tar.gz
Update contrib/libs/curl to 7.86.0
Diffstat (limited to 'contrib/libs/curl/lib/strcase.c')
-rw-r--r--contrib/libs/curl/lib/strcase.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/contrib/libs/curl/lib/strcase.c b/contrib/libs/curl/lib/strcase.c
index f932485204..09d2a8a961 100644
--- a/contrib/libs/curl/lib/strcase.c
+++ b/contrib/libs/curl/lib/strcase.c
@@ -28,8 +28,6 @@
#include "strcase.h"
-static char raw_tolower(char in);
-
/* Mapping table to go from lowercase to uppercase for plain ASCII.*/
static const unsigned char touppermap[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
@@ -79,7 +77,7 @@ char Curl_raw_toupper(char in)
/* Portable, consistent tolower. Do not use tolower() because its behavior is
altered by the current locale. */
-static char raw_tolower(char in)
+char Curl_raw_tolower(char in)
{
return tolowermap[(unsigned char) in];
}
@@ -165,7 +163,7 @@ void Curl_strntolower(char *dest, const char *src, size_t n)
return;
do {
- *dest++ = raw_tolower(*src);
+ *dest++ = Curl_raw_tolower(*src);
} while(*src++ && --n);
}
@@ -179,6 +177,28 @@ bool Curl_safecmp(char *a, char *b)
return !a && !b;
}
+/*
+ * Curl_timestrcmp() returns 0 if the two strings are identical. The time this
+ * function spends is a function of the shortest string, not of the contents.
+ */
+int Curl_timestrcmp(const char *a, const char *b)
+{
+ int match = 0;
+ int i = 0;
+
+ if(a && b) {
+ while(1) {
+ match |= a[i]^b[i];
+ if(!a[i] || !b[i])
+ break;
+ i++;
+ }
+ }
+ else
+ return a || b;
+ return match;
+}
+
/* --- public functions --- */
int curl_strequal(const char *first, const char *second)