Skip to content

Commit 117fde2

Browse files
author
Neil Conway
committed
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.)
1 parent 4802bb5 commit 117fde2

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/interfaces/ecpg/pgtypeslib/common.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@
22

33
#include "extern.h"
44

5+
/* Return value is zero-filled. */
56
char *
67
pgtypes_alloc(long size)
78
{
89
char *new = (char *) calloc(1L, size);
910

1011
if (!new)
11-
{
1212
errno = ENOMEM;
13-
return NULL;
14-
}
15-
16-
memset(new, '\0', size);
1713
return (new);
1814
}
1915

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy