Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitacbbeff

Browse files
committed
Clean up some ugly coding (hardwired constants) in index_formtuple.
1 parent33e5a4d commitacbbeff

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

‎src/backend/access/common/indextuple.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.44 2000/07/22 11:18:45 wieck Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.45 2000/09/23 22:40:12 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -46,8 +46,8 @@ index_formtuple(TupleDesc tupleDescriptor,
4646
uint16tupmask=0;
4747
intnumberOfAttributes=tupleDescriptor->natts;
4848
#ifdefTOAST_INDEX_HACK
49-
Datumuntoasted_value[MaxHeapAttributeNumber];
50-
booluntoasted_free[MaxHeapAttributeNumber];
49+
Datumuntoasted_value[INDEX_MAX_KEYS];
50+
booluntoasted_free[INDEX_MAX_KEYS];
5151
#endif
5252

5353
if (numberOfAttributes>INDEX_MAX_KEYS)
@@ -79,10 +79,14 @@ index_formtuple(TupleDesc tupleDescriptor,
7979
}
8080
}
8181
#endif
82-
for (i=0;i<numberOfAttributes&& !hasnull;i++)
82+
83+
for (i=0;i<numberOfAttributes;i++)
8384
{
8485
if (null[i]!=' ')
86+
{
8587
hasnull= true;
88+
break;
89+
}
8690
}
8791

8892
if (hasnull)
@@ -122,23 +126,21 @@ index_formtuple(TupleDesc tupleDescriptor,
122126
/*
123127
* We do this because DataFill wants to initialize a "tupmask" which
124128
* is used for HeapTuples, but we want an indextuple infomask.The
125-
* only"relevent" info is the "has variable attributes" field, which
126-
*is in mask position 0x02.We have already set thenull mask above.
129+
* onlyrelevant info is the "has variable attributes" field.
130+
* We have already set thehasnull bit above.
127131
*/
128132

129-
if (tupmask&0x02)
133+
if (tupmask&HEAP_HASVARLENA)
130134
infomask |=INDEX_VAR_MASK;
131135

132136
/*
133-
* Here we make sure that we can actually hold the size. We also want
134-
* to make sure that size is not aligned oddly. This actually is a
135-
* rather odd way to make sure the size is not too large overall.
137+
* Here we make sure that the size will fit in the field reserved for
138+
* it in t_info.
136139
*/
137140

138-
if (size&0xE000)
141+
if ((size&INDEX_SIZE_MASK)!=size)
139142
elog(ERROR,"index_formtuple: data takes %d bytes: too big",size);
140143

141-
142144
infomask |=size;
143145

144146
/* ----------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp