1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

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.)
This commit is contained in:
Tom Lane
2012-10-02 15:35:10 -04:00
parent 779f80b75d
commit a563d94180
28 changed files with 223 additions and 256 deletions

View File

@ -129,7 +129,7 @@ InitArchiveFmt_Custom(ArchiveHandle *AH)
AH->DeClonePtr = _DeClone;
/* Set up a private area. */
ctx = (lclContext *) pg_calloc(1, sizeof(lclContext));
ctx = (lclContext *) pg_malloc0(sizeof(lclContext));
AH->formatData = (void *) ctx;
/* Initialize LO buffering */
@ -198,7 +198,7 @@ _ArchiveEntry(ArchiveHandle *AH, TocEntry *te)
{
lclTocEntry *ctx;
ctx = (lclTocEntry *) pg_calloc(1, sizeof(lclTocEntry));
ctx = (lclTocEntry *) pg_malloc0(sizeof(lclTocEntry));
if (te->dataDumper)
ctx->dataState = K_OFFSET_POS_NOT_SET;
else
@ -239,7 +239,7 @@ _ReadExtraToc(ArchiveHandle *AH, TocEntry *te)
if (ctx == NULL)
{
ctx = (lclTocEntry *) pg_calloc(1, sizeof(lclTocEntry));
ctx = (lclTocEntry *) pg_malloc0(sizeof(lclTocEntry));
te->formatData = (void *) ctx;
}