diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-02-27 23:48:10 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-02-27 23:48:10 +0000 |
commit | 234a02b2a888cacc4c09363cc1411ae4eac9bb51 (patch) | |
tree | 4aadb74b5d7bbcfc3cdae9c8703eac168d6108ae /src/backend/access/common/reloptions.c | |
parent | 0459b591fc90b197ed31923b170c658cc30758d5 (diff) |
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
Diffstat (limited to 'src/backend/access/common/reloptions.c')
-rw-r--r-- | src/backend/access/common/reloptions.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c index 98cbce6761b..4adf4666e77 100644 --- a/src/backend/access/common/reloptions.c +++ b/src/backend/access/common/reloptions.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.3 2007/01/05 22:19:21 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.4 2007/02/27 23:48:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -72,8 +72,8 @@ transformRelOptions(Datum oldOptions, List *defList, for (i = 0; i < noldoptions; i++) { text *oldoption = DatumGetTextP(oldoptions[i]); - char *text_str = (char *) VARATT_DATA(oldoption); - int text_len = VARATT_SIZE(oldoption) - VARHDRSZ; + char *text_str = VARDATA(oldoption); + int text_len = VARSIZE(oldoption) - VARHDRSZ; /* Search for a match in defList */ foreach(cell, defList) @@ -131,8 +131,8 @@ transformRelOptions(Datum oldOptions, List *defList, len = VARHDRSZ + strlen(def->defname) + 1 + strlen(value); /* +1 leaves room for sprintf's trailing null */ t = (text *) palloc(len + 1); - VARATT_SIZEP(t) = len; - sprintf((char *) VARATT_DATA(t), "%s=%s", def->defname, value); + SET_VARSIZE(t, len); + sprintf(VARDATA(t), "%s=%s", def->defname, value); astate = accumArrayResult(astate, PointerGetDatum(t), false, TEXTOID, @@ -188,8 +188,8 @@ parseRelOptions(Datum options, int numkeywords, const char *const * keywords, for (i = 0; i < noptions; i++) { text *optiontext = DatumGetTextP(optiondatums[i]); - char *text_str = (char *) VARATT_DATA(optiontext); - int text_len = VARATT_SIZE(optiontext) - VARHDRSZ; + char *text_str = VARDATA(optiontext); + int text_len = VARSIZE(optiontext) - VARHDRSZ; int j; /* Search for a match in keywords */ @@ -267,7 +267,7 @@ default_reloptions(Datum reloptions, bool validate, } result = (StdRdOptions *) palloc(sizeof(StdRdOptions)); - VARATT_SIZEP(result) = sizeof(StdRdOptions); + SET_VARSIZE(result, sizeof(StdRdOptions)); result->fillfactor = fillfactor; |