From 1983af8e899389187026cb34c1ca9d89ea986120 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Wed, 27 Mar 2019 12:02:50 +0900 Subject: Switch some palloc/memset calls to palloc0 Some code paths have been doing some allocations followed by an immediate memset() to initialize the allocated area with zeros, this is a bit overkill as there are already interfaces to do both things in one call. Author: Daniel Gustafsson Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/vN0OodBPkKs7g2Z1uyk3CUEmhdtspHgYCImhlmSxv1Xn6nY1ZnaaGHL8EWUIQ-NEv36tyc4G5-uA3UXUF2l4sFXtK_EQgLN1hcgunlFVKhA=@yesql.se --- contrib/tablefunc/tablefunc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'contrib/tablefunc/tablefunc.c') diff --git a/contrib/tablefunc/tablefunc.c b/contrib/tablefunc/tablefunc.c index 02e49214101..cd02495c451 100644 --- a/contrib/tablefunc/tablefunc.c +++ b/contrib/tablefunc/tablefunc.c @@ -867,11 +867,8 @@ get_crosstab_tuplestore(char *sql, "tuple has %d columns but crosstab " \ "returns %d.", tupdesc->natts, result_ncols))); - /* allocate space */ - values = (char **) palloc(result_ncols * sizeof(char *)); - - /* and make sure it's clear */ - memset(values, '\0', result_ncols * sizeof(char *)); + /* allocate space and make sure it's clear */ + values = (char **) palloc0(result_ncols * sizeof(char *)); for (i = 0; i < proc; i++) { -- cgit v1.2.3