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.)
This commit is contained in:
parent
4802bb57a6
commit
117fde2d17
@ -2,18 +2,14 @@
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
/* Return value is zero-filled. */
|
||||
char *
|
||||
pgtypes_alloc(long size)
|
||||
{
|
||||
char *new = (char *) calloc(1L, size);
|
||||
|
||||
if (!new)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(new, '\0', size);
|
||||
return (new);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user