diff options
Diffstat (limited to 'src/tool_formparse.c')
-rw-r--r-- | src/tool_formparse.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/tool_formparse.c b/src/tool_formparse.c index 1ba6536a1..fa81291a6 100644 --- a/src/tool_formparse.c +++ b/src/tool_formparse.c @@ -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, |