8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.39 1998/08/19 02:00:53 momjian Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.40 1998/09/01 03:20:41 momjian Exp $
12
12
*
13
13
* NOTES
14
14
* The old interface functions have been converted to macros
@@ -55,13 +55,13 @@ long heap_sysoffset[] = {
55
55
*/
56
56
Size
57
57
ComputeDataSize (TupleDesc tupleDesc ,
58
- Datum value [] ,
59
- char nulls [] )
58
+ Datum * value ,
59
+ char * nulls )
60
60
{
61
61
uint32 data_length ;
62
62
int i ;
63
63
int numberOfAttributes = tupleDesc -> natts ;
64
- AttributeTupleForm * att = tupleDesc -> attrs ;
64
+ Form_pg_attribute * att = tupleDesc -> attrs ;
65
65
66
66
for (data_length = 0 , i = 0 ; i < numberOfAttributes ; i ++ )
67
67
{
@@ -118,8 +118,8 @@ ComputeDataSize(TupleDesc tupleDesc,
118
118
void
119
119
DataFill (char * data ,
120
120
TupleDesc tupleDesc ,
121
- Datum value [] ,
122
- char nulls [] ,
121
+ Datum * value ,
122
+ char * nulls ,
123
123
uint16 * infomask ,
124
124
bits8 * bit )
125
125
{
@@ -128,7 +128,7 @@ DataFill(char *data,
128
128
uint32 data_length ;
129
129
int i ;
130
130
int numberOfAttributes = tupleDesc -> natts ;
131
- AttributeTupleForm * att = tupleDesc -> attrs ;
131
+ Form_pg_attribute * att = tupleDesc -> attrs ;
132
132
133
133
if (bit != NULL )
134
134
{
@@ -227,13 +227,13 @@ int
227
227
heap_attisnull (HeapTuple tup , int attnum )
228
228
{
229
229
if (attnum > (int ) tup -> t_natts )
230
- return ( 1 ) ;
230
+ return 1 ;
231
231
232
232
if (HeapTupleNoNulls (tup ))
233
- return ( 0 ) ;
233
+ return 0 ;
234
234
235
235
if (attnum > 0 )
236
- return ( att_isnull (attnum - 1 , tup -> t_bits ) );
236
+ return att_isnull (attnum - 1 , tup -> t_bits );
237
237
else
238
238
switch (attnum )
239
239
{
@@ -252,7 +252,7 @@ heap_attisnull(HeapTuple tup, int attnum)
252
252
elog (ERROR , "heap_attisnull: undefined negative attnum" );
253
253
}
254
254
255
- return ( 0 ) ;
255
+ return 0 ;
256
256
}
257
257
258
258
/* ----------------------------------------------------------------
@@ -343,21 +343,21 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
343
343
switch (attnum )
344
344
{
345
345
case SelfItemPointerAttributeNumber :
346
- return (( Datum ) & tup -> t_ctid ) ;
346
+ return (Datum ) & tup -> t_ctid ;
347
347
case ObjectIdAttributeNumber :
348
- return (( Datum ) (long ) tup -> t_oid ) ;
348
+ return (Datum ) (long ) tup -> t_oid ;
349
349
case MinTransactionIdAttributeNumber :
350
- return (( Datum ) (long ) tup -> t_xmin ) ;
350
+ return (Datum ) (long ) tup -> t_xmin ;
351
351
case MinCommandIdAttributeNumber :
352
- return (( Datum ) (long ) tup -> t_cmin ) ;
352
+ return (Datum ) (long ) tup -> t_cmin ;
353
353
case MaxTransactionIdAttributeNumber :
354
- return (( Datum ) (long ) tup -> t_xmax ) ;
354
+ return (Datum ) (long ) tup -> t_xmax ;
355
355
case MaxCommandIdAttributeNumber :
356
- return (( Datum ) (long ) tup -> t_cmax ) ;
356
+ return (Datum ) (long ) tup -> t_cmax ;
357
357
default :
358
358
elog (ERROR , "heap_getsysattr: undefined attnum %d" , attnum );
359
359
}
360
- return (( Datum ) NULL ) ;
360
+ return (Datum ) NULL ;
361
361
}
362
362
363
363
/* ----------------
@@ -388,7 +388,7 @@ nocachegetattr(HeapTuple tup,
388
388
char * tp ; /* ptr to att in tuple */
389
389
bits8 * bp = tup -> t_bits ; /* ptr to att in tuple */
390
390
int slow ; /* do we have to walk nulls? */
391
- AttributeTupleForm * att = tupleDesc -> attrs ;
391
+ Form_pg_attribute * att = tupleDesc -> attrs ;
392
392
393
393
394
394
#if IN_MACRO
@@ -426,7 +426,7 @@ nocachegetattr(HeapTuple tup,
426
426
/*
427
427
* first attribute is always at position zero
428
428
*/
429
- return (( Datum ) fetchatt (& (att [0 ]), (char * ) tup + tup -> t_hoff ) );
429
+ return (Datum ) fetchatt (& (att [0 ]), (char * ) tup + tup -> t_hoff );
430
430
}
431
431
#endif
432
432
@@ -505,7 +505,7 @@ nocachegetattr(HeapTuple tup,
505
505
tp + att [attnum ]-> attcacheoff );
506
506
}
507
507
else if (attnum == 0 )
508
- return (( Datum ) fetchatt (& (att [0 ]), (char * ) tp ) );
508
+ return (Datum ) fetchatt (& (att [0 ]), (char * ) tp );
509
509
else if (!HeapTupleAllFixed (tup ))
510
510
{
511
511
int j = 0 ;
@@ -734,11 +734,11 @@ heap_copytuple(HeapTuple tuple)
734
734
HeapTuple newTuple ;
735
735
736
736
if (!HeapTupleIsValid (tuple ))
737
- return ( NULL ) ;
737
+ return NULL ;
738
738
739
739
newTuple = (HeapTuple ) palloc (tuple -> t_len );
740
740
memmove ((char * ) newTuple , (char * ) tuple , (int ) tuple -> t_len );
741
- return ( newTuple ) ;
741
+ return newTuple ;
742
742
}
743
743
744
744
#ifdef NOT_USED
@@ -751,8 +751,8 @@ heap_copytuple(HeapTuple tuple)
751
751
void
752
752
heap_deformtuple (HeapTuple tuple ,
753
753
TupleDesc tdesc ,
754
- Datum values [] ,
755
- char nulls [] )
754
+ Datum * values ,
755
+ char * nulls )
756
756
{
757
757
int i ;
758
758
int natts ;
@@ -780,7 +780,7 @@ heap_deformtuple(HeapTuple tuple,
780
780
/* ----------------
781
781
* heap_formtuple
782
782
*
783
- * constructs a tuple from the given value[] and null[] arrays
783
+ * constructs a tuple from the given * value and * null arrays
784
784
*
785
785
* old comments
786
786
* Handles alignment by aligning 2 byte attributes on short boundries
@@ -789,16 +789,16 @@ heap_deformtuple(HeapTuple tuple,
789
789
* not properly align fixed length arrays of 1 or 2 byte types (yet).
790
790
*
791
791
* Null attributes are indicated by a 'n' in the appropriate byte
792
- * of the null[] . Non-null attributes are indicated by a ' ' (space).
792
+ * of the * null. Non-null attributes are indicated by a ' ' (space).
793
793
*
794
794
* Fix me. (Figure that must keep context if debug--allow give oid.)
795
795
* Assumes in order.
796
796
* ----------------
797
797
*/
798
798
HeapTuple
799
799
heap_formtuple (TupleDesc tupleDescriptor ,
800
- Datum value [] ,
801
- char nulls [] )
800
+ Datum * value ,
801
+ char * nulls )
802
802
{
803
803
char * tp ; /* tuple pointer */
804
804
HeapTuple tuple ; /* return tuple */
@@ -849,7 +849,7 @@ heap_formtuple(TupleDesc tupleDescriptor,
849
849
850
850
tuple -> t_infomask |= HEAP_XMAX_INVALID ;
851
851
852
- return ( tuple ) ;
852
+ return tuple ;
853
853
}
854
854
855
855
/* ----------------
@@ -862,9 +862,9 @@ heap_formtuple(TupleDesc tupleDescriptor,
862
862
HeapTuple
863
863
heap_modifytuple (HeapTuple tuple ,
864
864
Relation relation ,
865
- Datum replValue [] ,
866
- char replNull [] ,
867
- char repl [] )
865
+ Datum * replValue ,
866
+ char * replNull ,
867
+ char * repl )
868
868
{
869
869
int attoff ;
870
870
int numberOfAttributes ;
@@ -884,10 +884,10 @@ heap_modifytuple(HeapTuple tuple,
884
884
Assert (PointerIsValid (replNull ));
885
885
Assert (PointerIsValid (repl ));
886
886
887
- numberOfAttributes = RelationGetRelationTupleForm (relation )-> relnatts ;
887
+ numberOfAttributes = RelationGetForm (relation )-> relnatts ;
888
888
889
889
/* ----------------
890
- * allocate and fill value[] and nulls[] arrays from either
890
+ * allocate and fill * value and * nulls arrays from either
891
891
* the tuple or the repl information, as appropriate.
892
892
* ----------------
893
893
*/
@@ -904,7 +904,7 @@ heap_modifytuple(HeapTuple tuple,
904
904
value [attoff ] =
905
905
heap_getattr (tuple ,
906
906
AttrOffsetGetAttrNumber (attoff ),
907
- RelationGetTupleDescriptor (relation ),
907
+ RelationGetDescr (relation ),
908
908
& isNull );
909
909
nulls [attoff ] = (isNull ) ? 'n' : ' ' ;
910
910
@@ -919,10 +919,10 @@ heap_modifytuple(HeapTuple tuple,
919
919
}
920
920
921
921
/* ----------------
922
- * create a new tuple from the values[] and nulls[] arrays
922
+ * create a new tuple from the * values and * nulls arrays
923
923
* ----------------
924
924
*/
925
- newTuple = heap_formtuple (RelationGetTupleDescriptor (relation ),
925
+ newTuple = heap_formtuple (RelationGetDescr (relation ),
926
926
value ,
927
927
nulls );
928
928
@@ -972,5 +972,5 @@ heap_addheader(uint32 natts, /* max domain index */
972
972
973
973
memmove (tp , structure , structlen );
974
974
975
- return ( tup ) ;
975
+ return tup ;
976
976
}
0 commit comments