summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2023-04-27 16:29:45 +0200
committerDaniel Stenberg <daniel@haxx.se>2023-04-27 17:24:47 +0200
commitd567cca1de689fb08da3557f81e7cae34257e438 (patch)
tree9ecf3b7a85bd5e6d3506ccf8a5ab55e4e3b894ed /src
parent4578ada4a0d14039cac1306fbc736851a9cb753c (diff)
downloadcurl-d567cca1de689fb08da3557f81e7cae34257e438.tar.gz
checksrc: fix SPACEBEFOREPAREN for conditions starting with "*"
The open paren check wants to warn for spaces before open parenthesis for if/while/for but also for any function call. In order to avoid catching function pointer declarations, the logic allows a space if the first character after the open parenthesis is an asterisk. I also spotted what we did not include "switch" in the check but we should. This check is a little lame, but we reduce this problem by not allowing that space for if/while/for/switch. Reported-by: Emanuele Torre Closes #11044
Diffstat (limited to 'src')
-rw-r--r--src/tool_paramhlp.c2
-rw-r--r--src/tool_urlglob.c4
-rw-r--r--src/tool_writeout_json.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c
index 52f9fdefb..bfcb6fcb4 100644
--- a/src/tool_paramhlp.c
+++ b/src/tool_paramhlp.c
@@ -369,7 +369,7 @@ ParameterError proto2num(struct OperationConfig *config,
/* Process token modifiers */
while(!ISALNUM(*token)) { /* may be NULL if token is all modifiers */
- switch (*token++) {
+ switch(*token++) {
case '=':
action = set;
break;
diff --git a/src/tool_urlglob.c b/src/tool_urlglob.c
index 44dd9a748..fe1ce64c6 100644
--- a/src/tool_urlglob.c
+++ b/src/tool_urlglob.c
@@ -100,7 +100,7 @@ static CURLcode glob_set(struct URLGlob *glob, char **patternp,
pat->globindex = globindex;
while(!done) {
- switch (*pattern) {
+ switch(*pattern) {
case '\0': /* URL ended while set was still open */
return GLOBERROR("unmatched brace", opos, CURLE_URL_MALFORMAT);
@@ -411,7 +411,7 @@ static CURLcode glob_parse(struct URLGlob *glob, char *pattern,
res = glob_fixed(glob, glob->glob_buffer, sublen);
}
else {
- switch (*pattern) {
+ switch(*pattern) {
case '\0': /* done */
break;
diff --git a/src/tool_writeout_json.c b/src/tool_writeout_json.c
index 6f21f2b2d..ec9c640b5 100644
--- a/src/tool_writeout_json.c
+++ b/src/tool_writeout_json.c
@@ -61,7 +61,7 @@ void jsonWriteString(FILE *stream, const char *in, bool lowercase)
fputs("\\t", stream);
break;
default:
- if (*i < 32) {
+ if(*i < 32) {
fprintf(stream, "u%04x", *i);
}
else {