mirror of
https://github.com/curl/curl.git
synced 2026-08-26 17:53:33 +03:00
tidy-up: drop stray comparisons with literal zero
Drop from: - strcmp, strcmpi, strncmp, memcmp, lstat, getrlimit, setrlimit, fseek, fstat - autotools detection snippets. - smooth-gtk-thread: simplify `!var != 0` expression. Closes #21947
This commit is contained in:
parent
2f3fa479dd
commit
97aed9c960
43 changed files with 142 additions and 143 deletions
|
|
@ -639,7 +639,7 @@ uint16_t Curl_cipher_suite_lookup_id(const char *cs_str, size_t cs_len)
|
|||
|
||||
if(cs_len > 0 && cs_str_to_zip(cs_str, cs_len, zip) == 0) {
|
||||
for(i = 0; i < CS_LIST_LEN; i++) {
|
||||
if(memcmp(cs_list[i].zip, zip, sizeof(zip)) == 0)
|
||||
if(!memcmp(cs_list[i].zip, zip, sizeof(zip)))
|
||||
return cs_list[i].id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,12 +205,12 @@ static gnutls_datum_t load_file(const char *file)
|
|||
f = curlx_fopen(file, "rb");
|
||||
if(!f)
|
||||
return loaded_file;
|
||||
if(fseek(f, 0, SEEK_END) != 0)
|
||||
if(fseek(f, 0, SEEK_END))
|
||||
goto out;
|
||||
filelen = ftell(f);
|
||||
if(filelen < 0 || filelen > CURL_MAX_INPUT_LENGTH)
|
||||
goto out;
|
||||
if(fseek(f, 0, SEEK_SET) != 0)
|
||||
if(fseek(f, 0, SEEK_SET))
|
||||
goto out;
|
||||
ptr = curlx_malloc((size_t)filelen);
|
||||
if(!ptr)
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ static CURLcode mbed_set_selected_ciphers(
|
|||
/* Add default TLSv1.3 ciphers to selection */
|
||||
for(j = 0; j < supported_len; j++) {
|
||||
uint16_t id = (uint16_t)supported[j];
|
||||
if(strncmp(mbedtls_ssl_get_ciphersuite_name(id), "TLS1-3", 6) != 0)
|
||||
if(strncmp(mbedtls_ssl_get_ciphersuite_name(id), "TLS1-3", 6))
|
||||
continue;
|
||||
|
||||
selected[count++] = id;
|
||||
|
|
@ -360,7 +360,7 @@ add_ciphers:
|
|||
/* Add default TLSv1.2 ciphers to selection */
|
||||
for(j = 0; j < supported_len; j++) {
|
||||
uint16_t id = (uint16_t)supported[j];
|
||||
if(strncmp(mbedtls_ssl_get_ciphersuite_name(id), "TLS1-3", 6) == 0)
|
||||
if(!strncmp(mbedtls_ssl_get_ciphersuite_name(id), "TLS1-3", 6))
|
||||
continue;
|
||||
|
||||
/* No duplicates allowed (so selected cannot overflow) */
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ static const char *c_memmem(const void *haystack, size_t haystacklen,
|
|||
return NULL;
|
||||
first = *(const char *)needle;
|
||||
for(p = (const char *)haystack; p <= (str_limit - needlelen); p++)
|
||||
if(((*p) == first) && (memcmp(p, needle, needlelen) == 0))
|
||||
if(((*p) == first) && !memcmp(p, needle, needlelen))
|
||||
return p;
|
||||
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -856,7 +856,7 @@ static CURLcode wssl_add_default_ciphers(bool tls13, struct dynbuf *buf)
|
|||
|
||||
for(i = 0; (str = wolfSSL_get_cipher_list(i)) != NULL; i++) {
|
||||
size_t n;
|
||||
if((strncmp(str, "TLS13", 5) == 0) != tls13)
|
||||
if((!strncmp(str, "TLS13", 5)) != tls13)
|
||||
continue;
|
||||
|
||||
/* if there already is data in the string, add colon separator */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue