Shouldn't we use palloc instead of malloc ?

Because of
 *      resetpsort  - resets (frees) malloc'd memory for an aborted Xaction
 *
 *      Not implemented yet.
This commit is contained in:
Vadim B. Mikheev 1997-05-20 11:35:50 +00:00
parent e7f7cf4a1c
commit 5f893a1e32
2 changed files with 8 additions and 8 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/lselect.c,v 1.2 1996/11/03 06:54:35 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/lselect.c,v 1.3 1997/05/20 11:35:48 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@ -43,7 +43,7 @@ extern Relation SortRdesc; /* later static */
#define PUTTUP(TUP, FP) fwrite((char *)TUP, (TUP)->t_len, 1, FP)
#define ENDRUN(FP) fwrite((char *)&shortzero, sizeof (shortzero), 1, FP)
#define GETLEN(LEN, FP) fread(&(LEN), sizeof (shortzero), 1, FP)
#define ALLOCTUP(LEN) ((HeapTuple)malloc((unsigned)LEN))
#define ALLOCTUP(LEN) ((HeapTuple)palloc((unsigned)LEN))
#define GETTUP(TUP, LEN, FP)\
fread((char *)(TUP) + sizeof (shortzero), 1, (LEN) - sizeof (shortzero), FP)
#define SETTUPLEN(TUP, LEN) (TUP)->t_len = LEN
@ -175,7 +175,7 @@ puttuple(struct leftist **treep, HeapTuple newtuple, int devnum)
register struct leftist *new1;
register struct leftist *tp;
new1 = (struct leftist *) malloc((unsigned) sizeof (struct leftist));
new1 = (struct leftist *) palloc((unsigned) sizeof (struct leftist));
USEMEM(sizeof (struct leftist));
new1->lt_dist = 1;
new1->lt_devnum = devnum;

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.3 1996/11/06 10:32:10 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.4 1997/05/20 11:35:50 vadim Exp $
*
* NOTES
* Sorts the first relation into the second relation. The sort may
@ -175,7 +175,7 @@ resetpsort()
fwrite((char *)TUP, (TUP)->t_len, 1, FP)
#define ENDRUN(FP) fwrite((char *)&shortzero, sizeof (shortzero), 1, FP)
#define GETLEN(LEN, FP) fread((char *)&(LEN), sizeof (shortzero), 1, FP)
#define ALLOCTUP(LEN) ((HeapTuple)malloc((unsigned)LEN))
#define ALLOCTUP(LEN) ((HeapTuple)palloc((unsigned)LEN))
#define GETTUP(TUP, LEN, FP)\
IncrProcessed(); \
BytesRead += (LEN) - sizeof (shortzero); \
@ -349,7 +349,7 @@ tuplecopy(HeapTuple tup, Relation rdesc, Buffer b)
if (!HeapTupleIsValid(tup)) {
return(NULL); /* just in case */
}
rettup = (HeapTuple)malloc(tup->t_len);
rettup = (HeapTuple)palloc(tup->t_len);
memmove((char *)rettup, (char *)tup, tup->t_len); /* XXX */
return(rettup);
}
@ -527,13 +527,13 @@ gettape()
static int tapeinit = 0;
char *mktemp();
tp = (struct tapelst *)malloc((unsigned)sizeof (struct tapelst));
tp = (struct tapelst *)palloc((unsigned)sizeof (struct tapelst));
if (!tapeinit) {
Tempfile[sizeof (TEMPDIR) - 1] = '/';
memmove(Tempfile + sizeof(TEMPDIR), TAPEEXT, sizeof (TAPEEXT));
tapeinit = 1;
}
tp->tl_name = malloc((unsigned)sizeof(Tempfile));
tp->tl_name = palloc((unsigned)sizeof(Tempfile));
/*
* now, copy template with final null into malloc'd space
*/