From 344de7fca2b781e71bd93f955b234537f3232a57 Mon Sep 17 00:00:00 2001
From: computezrmle <57127745+computezrmle@users.noreply.github.com>
Date: Fri, 29 Jul 2022 14:04:04 +0200
Subject: [PATCH] Remove redundant test in if-statement
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
While compiling the BOINC client on Linux using gcc I stumbled over another warning:
http_curl.cpp: In member function ‘int HTTP_OP::libcurl_exec(const char*, const char*, const char*, double, double, bool)’:
http_curl.cpp:605:13: warning: the address of ‘HTTP_OP::infile’ will never be NULL [-Waddress]
605 | if (infile && strlen(infile)>0) {
| ^~~~~~
In file included from gui_http.h:53,
from cs_notice.h:58,
from client_types.h:45,
from client_msgs.h:26,
from http_curl.cpp:44:
http_curl.h:86:10: note: ‘HTTP_OP::infile’ declared here
86 | char infile[256];
| ^~~~~~
Wouldn't it be enough to just test:
if (strlen(infile)>0) {
---
client/http_curl.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client/http_curl.cpp b/client/http_curl.cpp
index 777786a5f7..3b604261b4 100644
--- a/client/http_curl.cpp
+++ b/client/http_curl.cpp
@@ -602,7 +602,7 @@ int HTTP_OP::libcurl_exec(
if (is_post) {
want_upload = true;
want_download = false;
- if (infile && strlen(infile)>0) {
+ if (strlen(infile)>0) {
fileIn = boinc_fopen(infile, "rb");
if (!fileIn) {
msg_printf(NULL, MSG_INTERNAL_ERROR, "No HTTP input file %s", infile);