mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Replace direct assignments to VARATT_SIZEP(x) with SET_VARSIZE(x, len).
Get rid of VARATT_SIZE and VARATT_DATA, which were simply redundant with VARSIZE and VARDATA, and as a consequence almost no code was using the longer names. Rename the length fields of struct varlena and various derived structures to catch anyplace that was accessing them directly; and clean up various places so caught. In itself this patch doesn't change any behavior at all, but it is necessary infrastructure if we hope to play any games with the representation of varlena headers. Greg Stark and Tom Lane
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
* DMN Digital Music Network.
|
||||
* www.dmn.com
|
||||
*
|
||||
* $PostgreSQL: pgsql/contrib/intagg/int_aggregate.c,v 1.25 2006/07/11 17:04:12 momjian Exp $
|
||||
* $PostgreSQL: pgsql/contrib/intagg/int_aggregate.c,v 1.26 2007/02/27 23:48:06 tgl Exp $
|
||||
*
|
||||
* Copyright (C) Digital Music Network
|
||||
* December 20, 2001
|
||||
@ -88,7 +88,7 @@ GetPGArray(PGARRAY * p, AggState *aggstate, bool fAdd)
|
||||
int cb = PGARRAY_SIZE(START_NUM);
|
||||
|
||||
p = (PGARRAY *) MemoryContextAlloc(aggstate->aggcontext, cb);
|
||||
p->a.size = cb;
|
||||
SET_VARSIZE(p, cb);
|
||||
p->a.ndim = 1;
|
||||
p->a.dataoffset = 0; /* we don't support nulls, for now */
|
||||
p->a.elemtype = INT4OID;
|
||||
@ -105,8 +105,8 @@ GetPGArray(PGARRAY * p, AggState *aggstate, bool fAdd)
|
||||
int cbNew = PGARRAY_SIZE(n);
|
||||
|
||||
pn = (PGARRAY *) MemoryContextAlloc(aggstate->aggcontext, cbNew);
|
||||
memcpy(pn, p, p->a.size);
|
||||
pn->a.size = cbNew;
|
||||
memcpy(pn, p, VARSIZE(p));
|
||||
SET_VARSIZE(pn, cbNew);
|
||||
pn->lower = n;
|
||||
/* do not pfree(p), because nodeAgg.c will */
|
||||
p = pn;
|
||||
@ -132,7 +132,7 @@ ShrinkPGArray(PGARRAY * p)
|
||||
memcpy(pnew, p, cb);
|
||||
|
||||
/* fix up the fields in the new array to match normal conventions */
|
||||
pnew->a.size = cb;
|
||||
SET_VARSIZE(pnew, cb);
|
||||
pnew->lower = 1;
|
||||
|
||||
/* do not pfree(p), because nodeAgg.c will */
|
||||
|
Reference in New Issue
Block a user