diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-04-19 10:46:11 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-04-22 09:10:17 +0200 |
commit | 063d3f3b96e40b3bf770d04d90612064b9a53c49 (patch) | |
tree | df0a46b661da2352d190a24e4c829ac6052c2a14 /src | |
parent | 19ea52da4df3c3ebc399ae25e705c7a8b5d45d95 (diff) | |
download | curl-063d3f3b96e40b3bf770d04d90612064b9a53c49.tar.gz |
tidy-up: make conditional checks more consistent
... remove '== NULL' and '!= 0'
Closes #6912
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_convert.c | 6 | ||||
-rw-r--r-- | src/tool_metalink.c | 12 | ||||
-rw-r--r-- | src/tool_operate.c | 10 | ||||
-rw-r--r-- | src/tool_vms.c | 2 |
4 files changed, 15 insertions, 15 deletions
diff --git a/src/tool_convert.c b/src/tool_convert.c index 26ec07399..04818e9a6 100644 --- a/src/tool_convert.c +++ b/src/tool_convert.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -65,7 +65,7 @@ CURLcode convert_to_network(char *buffer, size_t length) in_bytes = out_bytes = length; res = iconv(outbound_cd, &input_ptr, &in_bytes, &output_ptr, &out_bytes); - if((res == (size_t)-1) || (in_bytes != 0)) { + if((res == (size_t)-1) || (in_bytes)) { return CURLE_CONV_FAILED; } @@ -95,7 +95,7 @@ CURLcode convert_from_network(char *buffer, size_t length) in_bytes = out_bytes = length; res = iconv(inbound_cd, &input_ptr, &in_bytes, &output_ptr, &out_bytes); - if((res == (size_t)-1) || (in_bytes != 0)) { + if((res == (size_t)-1) || (in_bytes)) { return CURLE_CONV_FAILED; } diff --git a/src/tool_metalink.c b/src/tool_metalink.c index 02fd5a5c2..2bdfbb743 100644 --- a/src/tool_metalink.c +++ b/src/tool_metalink.c @@ -534,7 +534,7 @@ int metalink_check_hash(struct GlobalConfig *config, { int rv; fprintf(config->errors, "Metalink: validating (%s)...\n", filename); - if(mlfile->checksum == NULL) { + if(!mlfile->checksum) { fprintf(config->errors, "Metalink: validating (%s) FAILED (digest missing)\n", filename); return -2; @@ -649,7 +649,7 @@ static struct metalinkfile *new_metalinkfile(metalink_file_t *fileinfo) fileinfo->resources point to the target file. BitTorrent metainfo file URL may be appeared in fileinfo->metaurls. */ - if((*p)->type == NULL || + if(!(*p)->type || curl_strequal((*p)->type, "http") || curl_strequal((*p)->type, "https") || curl_strequal((*p)->type, "ftp") || @@ -691,10 +691,10 @@ int parse_metalink(struct OperationConfig *config, struct OutStruct *outs, /* metlaink_parse_final deletes outs->metalink_parser */ r = metalink_parse_final(outs->metalink_parser, NULL, 0, &metalink); outs->metalink_parser = NULL; - if(r != 0) { + if(r) { return -1; } - if(metalink->files == NULL) { + if(!metalink->files) { fprintf(config->global->errors, "Metalink: parsing (%s) WARNING " "(missing or invalid file name)\n", metalink_url); @@ -824,7 +824,7 @@ static void delete_metalink_checksum(struct metalink_checksum *chksum) static void delete_metalink_resource(struct metalink_resource *res) { - if(res == NULL) { + if(!res) { return; } Curl_safefree(res->url); @@ -834,7 +834,7 @@ static void delete_metalink_resource(struct metalink_resource *res) void delete_metalinkfile(struct metalinkfile *mlfile) { struct metalink_resource *res; - if(mlfile == NULL) { + if(!mlfile) { return; } Curl_safefree(mlfile->filename); diff --git a/src/tool_operate.c b/src/tool_operate.c index 86e28b4cd..5e7a9fa87 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -167,14 +167,14 @@ static curl_off_t vms_realfilesize(const char *name, /* !checksrc! disable FOPENMODE 1 */ file = fopen(name, "r"); /* VMS */ - if(file == NULL) { + if(!file) { return 0; } count = 0; ret_stat = 1; while(ret_stat > 0) { ret_stat = fread(buffer, 1, sizeof(buffer), file); - if(ret_stat != 0) + if(ret_stat) count += ret_stat; } fclose(file); @@ -764,7 +764,7 @@ static CURLcode single_transfer(struct GlobalConfig *global, urlnode = config->state.urlnode; if(urlnode->flags & GETOUT_METALINK) { metalink = 1; - if(mlfile_last == NULL) { + if(!mlfile_last) { mlfile_last = config->metalinkfile_list; } mlfile = mlfile_last; @@ -1979,7 +1979,7 @@ static CURLcode single_transfer(struct GlobalConfig *global, /* curl 7.17.1 */ if(!config->nokeepalive) { my_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L); - if(config->alivetime != 0) { + if(config->alivetime) { my_setopt(curl, CURLOPT_TCP_KEEPIDLE, config->alivetime); my_setopt(curl, CURLOPT_TCP_KEEPINTVL, config->alivetime); } @@ -2128,7 +2128,7 @@ static CURLcode single_transfer(struct GlobalConfig *global, #ifdef USE_METALINK if(!metalink && config->use_metalink) { outs->metalink_parser = metalink_parser_context_new(); - if(outs->metalink_parser == NULL) { + if(!outs->metalink_parser) { result = CURLE_OUT_OF_MEMORY; break; } diff --git a/src/tool_vms.c b/src/tool_vms.c index 99728d08a..e250b7afd 100644 --- a/src/tool_vms.c +++ b/src/tool_vms.c @@ -56,7 +56,7 @@ int is_vms_shell(void) shell = getenv("SHELL"); /* No shell, means DCL */ - if(shell == NULL) { + if(!shell) { vms_shell = 1; return 1; } |