Commit 117fde2d authored by Neil Conway's avatar Neil Conway

Minor ecpg tweak: the return value of calloc() is guaranteed to be NULL

or zero-filled; therefore zero-filling it via memset() is pointless.
(I think setting `errno' is probably a waste of cycles as well, but I
haven't changed that.)
parent 4802bb57
...@@ -2,18 +2,14 @@ ...@@ -2,18 +2,14 @@
#include "extern.h" #include "extern.h"
/* Return value is zero-filled. */
char * char *
pgtypes_alloc(long size) pgtypes_alloc(long size)
{ {
char *new = (char *) calloc(1L, size); char *new = (char *) calloc(1L, size);
if (!new) if (!new)
{
errno = ENOMEM; errno = ENOMEM;
return NULL;
}
memset(new, '\0', size);
return (new); return (new);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment