mirror of
https://github.com/curl/curl.git
synced 2026-07-24 01:47:20 +03:00
misc: fix "warning: empty expression statement has no effect"
Turned several macros into do-while(0) style to allow their use to work find with semicolon. Bug:08e8455ddd (commitcomment-45433279)Follow-up to08e8455dddReported-by: Gisle Vanem Closes #6376
This commit is contained in:
parent
ec424f311a
commit
8ab78f720a
11 changed files with 84 additions and 69 deletions
|
|
@ -720,19 +720,22 @@ static int get_param_part(struct OperationConfig *config, char endchar,
|
|||
***************************************************************************/
|
||||
|
||||
/* Convenience macros for null pointer check. */
|
||||
#define NULL_CHECK(ptr, init, retcode) { \
|
||||
(ptr) = (init); \
|
||||
if(!(ptr)) { \
|
||||
warnf(config->global, "out of memory!\n"); \
|
||||
curl_slist_free_all(headers); \
|
||||
Curl_safefree(contents); \
|
||||
return retcode; \
|
||||
} \
|
||||
}
|
||||
#define SET_TOOL_MIME_PTR(m, field, retcode) { \
|
||||
if(field) \
|
||||
NULL_CHECK((m)->field, strdup(field), retcode); \
|
||||
}
|
||||
#define NULL_CHECK(ptr, init, retcode) \
|
||||
do { \
|
||||
(ptr) = (init); \
|
||||
if(!(ptr)) { \
|
||||
warnf(config->global, "out of memory!\n"); \
|
||||
curl_slist_free_all(headers); \
|
||||
Curl_safefree(contents); \
|
||||
return retcode; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define SET_TOOL_MIME_PTR(m, field, retcode) \
|
||||
do { \
|
||||
if(field) \
|
||||
NULL_CHECK((m)->field, strdup(field), retcode); \
|
||||
} while(0)
|
||||
|
||||
int formparse(struct OperationConfig *config,
|
||||
const char *input,
|
||||
|
|
|
|||
|
|
@ -362,10 +362,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
|
|||
}
|
||||
else
|
||||
#endif
|
||||
if(config->synthetic_error) {
|
||||
;
|
||||
}
|
||||
else if(result && global->showerror) {
|
||||
if(!config->synthetic_error && result && global->showerror) {
|
||||
fprintf(global->errors, "curl: (%d) %s\n", result,
|
||||
(per->errorbuffer[0]) ? per->errorbuffer :
|
||||
curl_easy_strerror(result));
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ static void jsonEscape(FILE *stream, const char *in)
|
|||
fputc(*i, stream);
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue