summaryrefslogtreecommitdiff
path: root/lib/strerror.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-12-14 01:29:44 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-12-14 01:29:44 +0100
commit1c3e8bbfedcd3822aeb1bab22fb56c5ecff4295b (patch)
treec1606588aeae4535f0faa7942fcbe50e6e340f8b /lib/strerror.c
parentb228d2952b6762b5c9b851fba0cf391e80c6761a (diff)
downloadcurl-1c3e8bbfedcd3822aeb1bab22fb56c5ecff4295b.tar.gz
checksrc: warn for assignments within if() expressions
... they're already frowned upon in our source code style guide, this now enforces the rule harder.
Diffstat (limited to 'lib/strerror.c')
-rw-r--r--lib/strerror.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/strerror.c b/lib/strerror.c
index 8f8ce036c..7e5cde47b 100644
--- a/lib/strerror.c
+++ b/lib/strerror.c
@@ -715,10 +715,12 @@ const char *Curl_strerror(struct connectdata *conn, int err)
buf[max] = '\0'; /* make sure the string is zero terminated */
/* strip trailing '\r\n' or '\n'. */
- if((p = strrchr(buf, '\n')) != NULL && (p - buf) >= 2)
- *p = '\0';
- if((p = strrchr(buf, '\r')) != NULL && (p - buf) >= 1)
- *p = '\0';
+ p = strrchr(buf, '\n');
+ if(p && (p - buf) >= 2)
+ *p = '\0';
+ p = strrchr(buf, '\r');
+ if(p && (p - buf) >= 1)
+ *p = '\0';
if(old_errno != ERRNO)
SET_ERRNO(old_errno);
@@ -1035,10 +1037,12 @@ const char *Curl_sspi_strerror (struct connectdata *conn, int err)
if(msg_formatted) {
msgbuf[sizeof(msgbuf)-1] = '\0';
/* strip trailing '\r\n' or '\n' */
- if((p = strrchr(msgbuf, '\n')) != NULL && (p - msgbuf) >= 2)
- *p = '\0';
- if((p = strrchr(msgbuf, '\r')) != NULL && (p - msgbuf) >= 1)
- *p = '\0';
+ p = strrchr(msgbuf, '\n');
+ if(p && (p - msgbuf) >= 2)
+ *p = '\0';
+ p = strrchr(msgbuf, '\r');
+ if(p && (p - msgbuf) >= 1)
+ *p = '\0';
msg = msgbuf;
}
if(msg)