From: Neil Conway Date: Thu, 30 Jun 2005 07:27:31 +0000 (+0000) Subject: Minor ecpg tweak: the return value of calloc() is guaranteed to be NULL X-Git-Tag: REL8_1_0BETA1~433 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=117fde2d1745c64c514db697b126350f7acf61a6;p=postgresql 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.) --- diff --git a/src/interfaces/ecpg/pgtypeslib/common.c b/src/interfaces/ecpg/pgtypeslib/common.c index d4b4009808..903013a2e3 100644 --- a/src/interfaces/ecpg/pgtypeslib/common.c +++ b/src/interfaces/ecpg/pgtypeslib/common.c @@ -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); }