mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
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:
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 PUTTUP(TUP, FP) fwrite((char *)TUP, (TUP)->t_len, 1, FP)
|
||||||
#define ENDRUN(FP) fwrite((char *)&shortzero, sizeof (shortzero), 1, FP)
|
#define ENDRUN(FP) fwrite((char *)&shortzero, sizeof (shortzero), 1, FP)
|
||||||
#define GETLEN(LEN, FP) fread(&(LEN), 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)\
|
#define GETTUP(TUP, LEN, FP)\
|
||||||
fread((char *)(TUP) + sizeof (shortzero), 1, (LEN) - sizeof (shortzero), FP)
|
fread((char *)(TUP) + sizeof (shortzero), 1, (LEN) - sizeof (shortzero), FP)
|
||||||
#define SETTUPLEN(TUP, LEN) (TUP)->t_len = LEN
|
#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 *new1;
|
||||||
register struct leftist *tp;
|
register struct leftist *tp;
|
||||||
|
|
||||||
new1 = (struct leftist *) malloc((unsigned) sizeof (struct leftist));
|
new1 = (struct leftist *) palloc((unsigned) sizeof (struct leftist));
|
||||||
USEMEM(sizeof (struct leftist));
|
USEMEM(sizeof (struct leftist));
|
||||||
new1->lt_dist = 1;
|
new1->lt_dist = 1;
|
||||||
new1->lt_devnum = devnum;
|
new1->lt_devnum = devnum;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* Sorts the first relation into the second relation. The sort may
|
* Sorts the first relation into the second relation. The sort may
|
||||||
@ -175,7 +175,7 @@ resetpsort()
|
|||||||
fwrite((char *)TUP, (TUP)->t_len, 1, FP)
|
fwrite((char *)TUP, (TUP)->t_len, 1, FP)
|
||||||
#define ENDRUN(FP) fwrite((char *)&shortzero, sizeof (shortzero), 1, FP)
|
#define ENDRUN(FP) fwrite((char *)&shortzero, sizeof (shortzero), 1, FP)
|
||||||
#define GETLEN(LEN, FP) fread((char *)&(LEN), 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)\
|
#define GETTUP(TUP, LEN, FP)\
|
||||||
IncrProcessed(); \
|
IncrProcessed(); \
|
||||||
BytesRead += (LEN) - sizeof (shortzero); \
|
BytesRead += (LEN) - sizeof (shortzero); \
|
||||||
@ -349,7 +349,7 @@ tuplecopy(HeapTuple tup, Relation rdesc, Buffer b)
|
|||||||
if (!HeapTupleIsValid(tup)) {
|
if (!HeapTupleIsValid(tup)) {
|
||||||
return(NULL); /* just in case */
|
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 */
|
memmove((char *)rettup, (char *)tup, tup->t_len); /* XXX */
|
||||||
return(rettup);
|
return(rettup);
|
||||||
}
|
}
|
||||||
@ -527,13 +527,13 @@ gettape()
|
|||||||
static int tapeinit = 0;
|
static int tapeinit = 0;
|
||||||
char *mktemp();
|
char *mktemp();
|
||||||
|
|
||||||
tp = (struct tapelst *)malloc((unsigned)sizeof (struct tapelst));
|
tp = (struct tapelst *)palloc((unsigned)sizeof (struct tapelst));
|
||||||
if (!tapeinit) {
|
if (!tapeinit) {
|
||||||
Tempfile[sizeof (TEMPDIR) - 1] = '/';
|
Tempfile[sizeof (TEMPDIR) - 1] = '/';
|
||||||
memmove(Tempfile + sizeof(TEMPDIR), TAPEEXT, sizeof (TAPEEXT));
|
memmove(Tempfile + sizeof(TEMPDIR), TAPEEXT, sizeof (TAPEEXT));
|
||||||
tapeinit = 1;
|
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
|
* now, copy template with final null into malloc'd space
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user