From a563d941803535dbd27d4191fe7729497b7fdf31 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 2 Oct 2012 15:35:10 -0400 Subject: Standardize naming of malloc/realloc/strdup wrapper functions. We had a number of variants on the theme of "malloc or die", with the majority named like "pg_malloc", but by no means all. Standardize on the names pg_malloc, pg_malloc0, pg_realloc, pg_strdup. Get rid of pg_calloc entirely in favor of using pg_malloc0. This is an essentially cosmetic change, so no back-patch. (I did find a couple of places where psql and pg_dump were using plain malloc or strdup instead of the pg_ versions, but they don't look significant enough to bother back-patching.) --- src/bin/psql/common.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'src/bin/psql/common.c') diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index f5bd0f6d42..1cb30088c4 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -70,26 +70,12 @@ pg_malloc(size_t size) } void * -pg_malloc_zero(size_t size) +pg_malloc0(size_t size) { void *tmp; tmp = pg_malloc(size); - memset(tmp, 0, size); - return tmp; -} - -void * -pg_calloc(size_t nmemb, size_t size) -{ - void *tmp; - - tmp = calloc(nmemb, size); - if (!tmp) - { - psql_error("out of memory\n"); - exit(EXIT_FAILURE); - } + MemSet(tmp, 0, size); return tmp; } -- cgit v1.2.1