mirror of
https://github.com/postgres/postgres.git
synced 2025-11-25 12:03:53 +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:
@@ -159,7 +159,7 @@ InitArchiveFmt_Tar(ArchiveHandle *AH)
|
||||
/*
|
||||
* Set up some special context used in compressing data.
|
||||
*/
|
||||
ctx = (lclContext *) pg_calloc(1, sizeof(lclContext));
|
||||
ctx = (lclContext *) pg_malloc0(sizeof(lclContext));
|
||||
AH->formatData = (void *) ctx;
|
||||
ctx->filePos = 0;
|
||||
ctx->isSpecialScript = 0;
|
||||
@@ -266,7 +266,7 @@ _ArchiveEntry(ArchiveHandle *AH, TocEntry *te)
|
||||
lclTocEntry *ctx;
|
||||
char fn[K_STD_BUF_SIZE];
|
||||
|
||||
ctx = (lclTocEntry *) pg_calloc(1, sizeof(lclTocEntry));
|
||||
ctx = (lclTocEntry *) pg_malloc0(sizeof(lclTocEntry));
|
||||
if (te->dataDumper != NULL)
|
||||
{
|
||||
#ifdef HAVE_LIBZ
|
||||
@@ -305,7 +305,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;
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ tarOpen(ArchiveHandle *AH, const char *filename, char mode)
|
||||
}
|
||||
else
|
||||
{
|
||||
tm = pg_calloc(1, sizeof(TAR_MEMBER));
|
||||
tm = pg_malloc0(sizeof(TAR_MEMBER));
|
||||
|
||||
#ifndef WIN32
|
||||
tm->tmpFH = tmpfile();
|
||||
@@ -1128,7 +1128,7 @@ static TAR_MEMBER *
|
||||
_tarPositionTo(ArchiveHandle *AH, const char *filename)
|
||||
{
|
||||
lclContext *ctx = (lclContext *) AH->formatData;
|
||||
TAR_MEMBER *th = pg_calloc(1, sizeof(TAR_MEMBER));
|
||||
TAR_MEMBER *th = pg_malloc0(sizeof(TAR_MEMBER));
|
||||
char c;
|
||||
char header[512];
|
||||
size_t i,
|
||||
|
||||
Reference in New Issue
Block a user