lib: call Curl_strntolower instead of doing crafted loops
Closes #13627
This commit is contained in:
Родитель
9d6d614264
Коммит
aef369867f
|
@ -167,17 +167,12 @@ create_hostcache_id(const char *name,
|
|||
int port, char *ptr, size_t buflen)
|
||||
{
|
||||
size_t len = nlen ? nlen : strlen(name);
|
||||
size_t olen = 0;
|
||||
DEBUGASSERT(buflen >= MAX_HOSTCACHE_LEN);
|
||||
if(len > (buflen - 7))
|
||||
len = buflen - 7;
|
||||
/* store and lower case the name */
|
||||
while(len--) {
|
||||
*ptr++ = Curl_raw_tolower(*name++);
|
||||
olen++;
|
||||
}
|
||||
olen += msnprintf(ptr, 7, ":%u", port);
|
||||
return olen;
|
||||
Curl_strntolower(ptr, name, len);
|
||||
return msnprintf(&ptr[len], 7, ":%u", port) + len;
|
||||
}
|
||||
|
||||
struct hostcache_prune_data {
|
||||
|
|
|
@ -234,10 +234,8 @@ size_t Curl_is_absolute_url(const char *url, char *buf, size_t buflen,
|
|||
/* the length of the scheme is the name part only */
|
||||
size_t len = i;
|
||||
if(buf) {
|
||||
Curl_strntolower(buf, url, i);
|
||||
buf[i] = 0;
|
||||
while(i--) {
|
||||
buf[i] = Curl_raw_tolower(url[i]);
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче