mirror of
https://github.com/postgres/postgres.git
synced 2025-05-11 05:41:32 +03:00
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"
|
#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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user