summaryrefslogtreecommitdiff
path: root/src/backend/access/common
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2008-04-17 21:37:28 +0000
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2008-04-17 21:37:28 +0000
commit2f0f7b4bce13e68394543728801ef011fd82fac6 (patch)
tree0a8d0a662ac316ac07f33e10cd607ca0a49eac25 /src/backend/access/common
parent25e46a504b215fb7e11463d628d3477098323367 (diff)
Clean up a few places where Datums were being treated as pointers (and vice
versa) without going through DatumGetPointer. Gavin Sherry, with Feng Tian.
Diffstat (limited to 'src/backend/access/common')
-rw-r--r--src/backend/access/common/heaptuple.c6
-rw-r--r--src/backend/access/common/indextuple.c8
-rw-r--r--src/backend/access/common/printtup.c10
-rw-r--r--src/backend/access/common/reloptions.c10
4 files changed, 17 insertions, 17 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index 5dd3848ea2f..d7af277e65f 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -57,7 +57,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.120 2008/01/01 19:45:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.121 2008/04/17 21:37:28 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@@ -890,7 +890,7 @@ heap_form_tuple(TupleDesc tupleDescriptor,
else if (att[i]->attlen == -1 &&
att[i]->attalign == 'd' &&
att[i]->attndims == 0 &&
- !VARATT_IS_EXTENDED(values[i]))
+ !VARATT_IS_EXTENDED(DatumGetPointer(values[i])))
{
values[i] = toast_flatten_tuple_attribute(values[i],
att[i]->atttypid,
@@ -1001,7 +1001,7 @@ heap_formtuple(TupleDesc tupleDescriptor,
else if (att[i]->attlen == -1 &&
att[i]->attalign == 'd' &&
att[i]->attndims == 0 &&
- !VARATT_IS_EXTENDED(values[i]))
+ !VARATT_IS_EXTENDED(DatumGetPointer(values[i])))
{
values[i] = toast_flatten_tuple_attribute(values[i],
att[i]->atttypid,
diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c
index 06bae46fbd1..9aa320a4351 100644
--- a/src/backend/access/common/indextuple.c
+++ b/src/backend/access/common/indextuple.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.85 2008/01/01 19:45:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.86 2008/04/17 21:37:28 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@@ -73,7 +73,7 @@ index_form_tuple(TupleDesc tupleDescriptor,
* If value is stored EXTERNAL, must fetch it so we are not depending
* on outside storage. This should be improved someday.
*/
- if (VARATT_IS_EXTERNAL(values[i]))
+ if (VARATT_IS_EXTERNAL(DatumGetPointer(values[i])))
{
untoasted_values[i] =
PointerGetDatum(heap_tuple_fetch_attr((struct varlena *)
@@ -85,8 +85,8 @@ index_form_tuple(TupleDesc tupleDescriptor,
* If value is above size target, and is of a compressible datatype,
* try to compress it in-line.
*/
- if (!VARATT_IS_EXTENDED(untoasted_values[i]) &&
- VARSIZE(untoasted_values[i]) > TOAST_INDEX_TARGET &&
+ if (!VARATT_IS_EXTENDED(DatumGetPointer(untoasted_values[i])) &&
+ VARSIZE(DatumGetPointer(untoasted_values[i])) > TOAST_INDEX_TARGET &&
(att->attstorage == 'x' || att->attstorage == 'm'))
{
Datum cvalue = toast_compress_datum(untoasted_values[i]);
diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c
index d3f017ab95d..346f6e1d8ab 100644
--- a/src/backend/access/common/printtup.c
+++ b/src/backend/access/common/printtup.c
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.101 2008/01/01 19:45:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.102 2008/04/17 21:37:28 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@@ -340,7 +340,7 @@ printtup(TupleTableSlot *slot, DestReceiver *self)
}
/* Clean up detoasted copy, if any */
- if (attr != origattr)
+ if (DatumGetPointer(attr) != DatumGetPointer(origattr))
pfree(DatumGetPointer(attr));
}
@@ -423,7 +423,7 @@ printtup_20(TupleTableSlot *slot, DestReceiver *self)
pfree(outputstr);
/* Clean up detoasted copy, if any */
- if (attr != origattr)
+ if (DatumGetPointer(attr) != DatumGetPointer(origattr))
pfree(DatumGetPointer(attr));
}
@@ -537,7 +537,7 @@ debugtup(TupleTableSlot *slot, DestReceiver *self)
pfree(value);
/* Clean up detoasted copy, if any */
- if (attr != origattr)
+ if (DatumGetPointer(attr) != DatumGetPointer(origattr))
pfree(DatumGetPointer(attr));
}
printf("\t----\n");
@@ -627,7 +627,7 @@ printtup_internal_20(TupleTableSlot *slot, DestReceiver *self)
pfree(outputbytes);
/* Clean up detoasted copy, if any */
- if (attr != origattr)
+ if (DatumGetPointer(attr) != DatumGetPointer(origattr))
pfree(DatumGetPointer(attr));
}
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index fc5b6ebdcac..8822535998f 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.9 2008/03/25 22:42:42 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.10 2008/04/17 21:37:28 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
@@ -58,7 +58,7 @@ transformRelOptions(Datum oldOptions, List *defList,
astate = NULL;
/* Copy any oldOptions that aren't to be replaced */
- if (oldOptions != (Datum) 0)
+ if (PointerIsValid(DatumGetPointer(oldOptions)))
{
ArrayType *array = DatumGetArrayTypeP(oldOptions);
Datum *oldoptions;
@@ -164,7 +164,7 @@ untransformRelOptions(Datum options)
int i;
/* Nothing to do if no options */
- if (options == (Datum) 0)
+ if (!PointerIsValid(DatumGetPointer(options)))
return result;
array = DatumGetArrayTypeP(options);
@@ -220,7 +220,7 @@ parseRelOptions(Datum options, int numkeywords, const char *const * keywords,
MemSet(values, 0, numkeywords * sizeof(char *));
/* Done if no options */
- if (options == (Datum) 0)
+ if (!PointerIsValid(DatumGetPointer(options)))
return;
array = DatumGetArrayTypeP(options);
@@ -349,7 +349,7 @@ index_reloptions(RegProcedure amoptions, Datum reloptions, bool validate)
Assert(RegProcedureIsValid(amoptions));
/* Assume function is strict */
- if (reloptions == (Datum) 0)
+ if (!PointerIsValid(DatumGetPointer(reloptions)))
return NULL;
/* Can't use OidFunctionCallN because we might get a NULL result */