Remove redundant malloc+memset calls in favor of calloc.
This commit is contained in:
parent
f93a73148f
commit
61415b6069
@ -12,11 +12,10 @@ int reqgen_gopher(const char *path, char **nbuf)
|
||||
|
||||
buflen = (strlen(REQ_GOPH) + strlen(path) + 1);
|
||||
|
||||
if( !(*nbuf = malloc(buflen)))
|
||||
{
|
||||
return(ERRMEM);
|
||||
}
|
||||
memset(*nbuf, 0, buflen);
|
||||
if( !(*nbuf = calloc(buflen, sizeof(char))))
|
||||
{
|
||||
return(ERRMEM);
|
||||
}
|
||||
|
||||
sprintf(*nbuf, REQ_GOPH, path);
|
||||
|
||||
|
@ -12,11 +12,10 @@ int reqgen_http(const char *path, const char *fqdn, char **nbuf)
|
||||
|
||||
buflen = (strlen(REQ_HTTP) + strlen(path) + strlen(fqdn) + 1);
|
||||
|
||||
if( !(*nbuf = malloc(buflen)))
|
||||
{
|
||||
return(ERRMEM);
|
||||
}
|
||||
memset(*nbuf, 0, buflen);
|
||||
if( !(*nbuf = calloc(buflen, sizeof(char))))
|
||||
{
|
||||
return(ERRMEM);
|
||||
}
|
||||
|
||||
sprintf(*nbuf, REQ_HTTP, path, fqdn);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user