Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5f893a1

Browse files
committed
Shouldn't we use palloc instead of malloc ?
Because of * resetpsort - resets (frees) malloc'd memory for an aborted Xaction * * Not implemented yet.
1 parente7f7cf4 commit5f893a1

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

‎src/backend/utils/sort/lselect.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/lselect.c,v 1.2 1996/11/03 06:54:35 scrappy Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/lselect.c,v 1.3 1997/05/20 11:35:48 vadim Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -43,7 +43,7 @@ externRelationSortRdesc;/* later static */
4343
#definePUTTUP(TUP,FP)fwrite((char *)TUP, (TUP)->t_len, 1, FP)
4444
#defineENDRUN(FP)fwrite((char *)&shortzero, sizeof (shortzero), 1, FP)
4545
#defineGETLEN(LEN,FP)fread(&(LEN), sizeof (shortzero), 1, FP)
46-
#defineALLOCTUP(LEN)((HeapTuple)malloc((unsigned)LEN))
46+
#defineALLOCTUP(LEN)((HeapTuple)palloc((unsigned)LEN))
4747
#defineGETTUP(TUP,LEN,FP)\
4848
fread((char *)(TUP) + sizeof (shortzero), 1, (LEN) - sizeof (shortzero), FP)
4949
#defineSETTUPLEN(TUP,LEN)(TUP)->t_len = LEN
@@ -175,7 +175,7 @@ puttuple(struct leftist **treep, HeapTuple newtuple, int devnum)
175175
registerstructleftist*new1;
176176
registerstructleftist*tp;
177177

178-
new1= (structleftist*)malloc((unsigned)sizeof (structleftist));
178+
new1= (structleftist*)palloc((unsigned)sizeof (structleftist));
179179
USEMEM(sizeof (structleftist));
180180
new1->lt_dist=1;
181181
new1->lt_devnum=devnum;

‎src/backend/utils/sort/psort.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.3 1996/11/06 10:32:10 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.4 1997/05/20 11:35:50 vadim Exp $
1111
*
1212
* NOTES
1313
*Sorts the first relation into the second relation. The sort may
@@ -175,7 +175,7 @@ resetpsort()
175175
fwrite((char *)TUP, (TUP)->t_len, 1, FP)
176176
#defineENDRUN(FP)fwrite((char *)&shortzero, sizeof (shortzero), 1, FP)
177177
#defineGETLEN(LEN,FP)fread((char *)&(LEN), sizeof (shortzero), 1, FP)
178-
#defineALLOCTUP(LEN)((HeapTuple)malloc((unsigned)LEN))
178+
#defineALLOCTUP(LEN)((HeapTuple)palloc((unsigned)LEN))
179179
#defineGETTUP(TUP,LEN,FP)\
180180
IncrProcessed(); \
181181
BytesRead += (LEN) - sizeof (shortzero); \
@@ -349,7 +349,7 @@ tuplecopy(HeapTuple tup, Relation rdesc, Buffer b)
349349
if (!HeapTupleIsValid(tup)) {
350350
return(NULL);/* just in case */
351351
}
352-
rettup= (HeapTuple)malloc(tup->t_len);
352+
rettup= (HeapTuple)palloc(tup->t_len);
353353
memmove((char*)rettup, (char*)tup,tup->t_len);/* XXX */
354354
return(rettup);
355355
}
@@ -527,13 +527,13 @@ gettape()
527527
staticinttapeinit=0;
528528
char*mktemp();
529529

530-
tp= (structtapelst*)malloc((unsigned)sizeof (structtapelst));
530+
tp= (structtapelst*)palloc((unsigned)sizeof (structtapelst));
531531
if (!tapeinit) {
532532
Tempfile[sizeof (TEMPDIR)-1]='/';
533533
memmove(Tempfile+sizeof(TEMPDIR),TAPEEXT,sizeof (TAPEEXT));
534534
tapeinit=1;
535535
}
536-
tp->tl_name=malloc((unsigned)sizeof(Tempfile));
536+
tp->tl_name=palloc((unsigned)sizeof(Tempfile));
537537
/*
538538
* now, copy template with final null into malloc'd space
539539
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp