From 572e3e6634e55accf95e2bcfb1340019c86a21dc Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 25 Mar 2019 09:35:22 +0100 Subject: [PATCH] Initialize structure at declaration Avoids extra memset call and cast. Discussion: https://www.postgresql.org/message-id/flat/7a5cbea7-b8df-e910-0f10-04014bcad701%402ndquadrant.com --- contrib/dblink/dblink.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c index d95e6bfa71..d35e5ba3d8 100644 --- a/contrib/dblink/dblink.c +++ b/contrib/dblink/dblink.c @@ -982,13 +982,11 @@ materializeQueryResult(FunctionCallInfo fcinfo, { ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; PGresult *volatile res = NULL; - volatile storeInfo sinfo; + volatile storeInfo sinfo = {0}; /* prepTuplestoreResult must have been called previously */ Assert(rsinfo->returnMode == SFRM_Materialize); - /* initialize storeInfo to empty */ - memset((void *) &sinfo, 0, sizeof(sinfo)); sinfo.fcinfo = fcinfo; PG_TRY();