From 234a02b2a888cacc4c09363cc1411ae4eac9bb51 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 27 Feb 2007 23:48:10 +0000 Subject: 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 --- src/backend/utils/adt/acl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/backend/utils/adt/acl.c') diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index c9f9a07f230..0865c7f0d60 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.137 2007/01/05 22:19:39 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.138 2007/02/27 23:48:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -353,7 +353,7 @@ allocacl(int n) elog(ERROR, "invalid size: %d", n); size = ACL_N_SIZE(n); new_acl = (Acl *) palloc0(size); - new_acl->size = size; + SET_VARSIZE(new_acl, size); new_acl->ndim = 1; new_acl->dataoffset = 0; /* we never put in any nulls */ new_acl->elemtype = ACLITEMOID; @@ -716,8 +716,9 @@ aclupdate(const Acl *old_acl, const AclItem *mod_aip, memmove(new_aip + dst, new_aip + dst + 1, (num - dst - 1) * sizeof(AclItem)); + /* Adjust array size to be 'num - 1' items */ ARR_DIMS(new_acl)[0] = num - 1; - ARR_SIZE(new_acl) -= sizeof(AclItem); + SET_VARSIZE(new_acl, ACL_N_SIZE(num - 1)); } /* @@ -830,7 +831,7 @@ aclnewowner(const Acl *old_acl, Oid oldOwnerId, Oid newOwnerId) } /* Adjust array size to be 'dst' items */ ARR_DIMS(new_acl)[0] = dst; - ARR_SIZE(new_acl) = ACL_N_SIZE(dst); + SET_VARSIZE(new_acl, ACL_N_SIZE(dst)); } return new_acl; -- cgit v1.2.3