diff options
author | Daniel Gustafsson <daniel@yesql.se> | 2022-12-08 23:45:18 +0100 |
---|---|---|
committer | Daniel Gustafsson <daniel@yesql.se> | 2022-12-08 23:45:18 +0100 |
commit | 76b73c746851f94f8d5e6c5150413d534e9c2c8d (patch) | |
tree | 4091bf6826e0d2175e99e00e536fbdfe372348c2 /src | |
parent | 60453483b5c26447df95a8a80712e809094cb2a2 (diff) | |
download | curl-76b73c746851f94f8d5e6c5150413d534e9c2c8d.tar.gz |
tool_formparse: avoid clobbering on function params
While perfectly legal to do, clobbering function parameters and using
them as local variables is confusing at best and rarely improves code
readability. Fix by using a local variable instead, no functionality
is changed.
This also renames the parameter from data to mime_data since the term
data is (soft) reserved for the easy handle struct.
Closes: #10046
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_formparse.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/tool_formparse.c b/src/tool_formparse.c index d4fc651e2..5dc24fe7e 100644 --- a/src/tool_formparse.c +++ b/src/tool_formparse.c @@ -61,17 +61,18 @@ static struct tool_mime *tool_mime_new_parts(struct tool_mime *parent) } static struct tool_mime *tool_mime_new_data(struct tool_mime *parent, - char *data) + char *mime_data) { + char *mime_data_copy; struct tool_mime *m = NULL; - data = strdup(data); - if(data) { + mime_data_copy = strdup(mime_data); + if(mime_data_copy) { m = tool_mime_new(parent, TOOLMIME_DATA); if(!m) - free(data); + free(mime_data_copy); else - m->data = data; + m->data = mime_data_copy; } return m; } |