Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1d91d24

Browse files
committed
Add const to values and nulls arguments
This excludes any changes that would change the external AM APIs. Reviewed-by: Aleksander Alekseev <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/14c31f4a-0347-0805-dce8-93a9072c05a5%40eisentraut.org
1 parent fc4089f commit 1d91d24

File tree

28 files changed

+83
-83
lines changed

28 files changed

+83
-83
lines changed

src/backend/access/brin/brin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static void union_tuples(BrinDesc *bdesc, BrinMemTuple *a,
8080
BrinTuple *b);
8181
static void brin_vacuum_scan(Relation idxrel, BufferAccessStrategy strategy);
8282
static bool add_values_to_range(Relation idxRel, BrinDesc *bdesc,
83-
BrinMemTuple *dtup, Datum *values, bool *nulls);
83+
BrinMemTuple *dtup, const Datum *values, const bool *nulls);
8484
static bool check_null_keys(BrinValues *bval, ScanKey *nullkeys, int nnullkeys);
8585

8686
/*
@@ -1774,7 +1774,7 @@ brin_vacuum_scan(Relation idxrel, BufferAccessStrategy strategy)
17741774

17751775
static bool
17761776
add_values_to_range(Relation idxRel, BrinDesc *bdesc, BrinMemTuple *dtup,
1777-
Datum *values, bool *nulls)
1777+
const Datum *values, const bool *nulls)
17781778
{
17791779
int keyno;
17801780

src/backend/access/common/heaptuple.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ getmissingattr(TupleDesc tupleDesc,
205205
*/
206206
Size
207207
heap_compute_data_size(TupleDesc tupleDesc,
208-
Datum *values,
209-
bool *isnull)
208+
const Datum *values,
209+
const bool *isnull)
210210
{
211211
Size data_length = 0;
212212
int i;
@@ -390,7 +390,7 @@ fill_val(Form_pg_attribute att,
390390
*/
391391
void
392392
heap_fill_tuple(TupleDesc tupleDesc,
393-
Datum *values, bool *isnull,
393+
const Datum *values, const bool *isnull,
394394
char *data, Size data_size,
395395
uint16 *infomask, bits8 *bit)
396396
{
@@ -1106,8 +1106,8 @@ heap_copy_tuple_as_datum(HeapTuple tuple, TupleDesc tupleDesc)
11061106
*/
11071107
HeapTuple
11081108
heap_form_tuple(TupleDesc tupleDescriptor,
1109-
Datum *values,
1110-
bool *isnull)
1109+
const Datum *values,
1110+
const bool *isnull)
11111111
{
11121112
HeapTuple tuple; /* return tuple */
11131113
HeapTupleHeader td; /* tuple data */
@@ -1200,9 +1200,9 @@ heap_form_tuple(TupleDesc tupleDescriptor,
12001200
HeapTuple
12011201
heap_modify_tuple(HeapTuple tuple,
12021202
TupleDesc tupleDesc,
1203-
Datum *replValues,
1204-
bool *replIsnull,
1205-
bool *doReplace)
1203+
const Datum *replValues,
1204+
const bool *replIsnull,
1205+
const bool *doReplace)
12061206
{
12071207
int numberOfAttributes = tupleDesc->natts;
12081208
int attoff;
@@ -1269,9 +1269,9 @@ HeapTuple
12691269
heap_modify_tuple_by_cols(HeapTuple tuple,
12701270
TupleDesc tupleDesc,
12711271
int nCols,
1272-
int *replCols,
1273-
Datum *replValues,
1274-
bool *replIsnull)
1272+
const int *replCols,
1273+
const Datum *replValues,
1274+
const bool *replIsnull)
12751275
{
12761276
int numberOfAttributes = tupleDesc->natts;
12771277
Datum *values;
@@ -1442,8 +1442,8 @@ heap_freetuple(HeapTuple htup)
14421442
*/
14431443
MinimalTuple
14441444
heap_form_minimal_tuple(TupleDesc tupleDescriptor,
1445-
Datum *values,
1446-
bool *isnull)
1445+
const Datum *values,
1446+
const bool *isnull)
14471447
{
14481448
MinimalTuple tuple; /* return tuple */
14491449
Size len,

src/backend/access/common/indextuple.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
*/
4343
IndexTuple
4444
index_form_tuple(TupleDesc tupleDescriptor,
45-
Datum *values,
46-
bool *isnull)
45+
const Datum *values,
46+
const bool *isnull)
4747
{
4848
return index_form_tuple_context(tupleDescriptor, values, isnull,
4949
CurrentMemoryContext);
@@ -63,8 +63,8 @@ index_form_tuple(TupleDesc tupleDescriptor,
6363
*/
6464
IndexTuple
6565
index_form_tuple_context(TupleDesc tupleDescriptor,
66-
Datum *values,
67-
bool *isnull,
66+
const Datum *values,
67+
const bool *isnull,
6868
MemoryContext context)
6969
{
7070
char *tp; /* tuple pointer */
@@ -79,8 +79,8 @@ index_form_tuple_context(TupleDesc tupleDescriptor,
7979
int numberOfAttributes = tupleDescriptor->natts;
8080

8181
#ifdef TOAST_INDEX_HACK
82-
Datum untoasted_values[INDEX_MAX_KEYS];
83-
bool untoasted_free[INDEX_MAX_KEYS];
82+
Datum untoasted_values[INDEX_MAX_KEYS] = {0};
83+
bool untoasted_free[INDEX_MAX_KEYS] = {0};
8484
#endif
8585

8686
if (numberOfAttributes > INDEX_MAX_KEYS)

src/backend/access/gist/gistutil.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e,
573573

574574
IndexTuple
575575
gistFormTuple(GISTSTATE *giststate, Relation r,
576-
Datum *attdata, bool *isnull, bool isleaf)
576+
const Datum *attdata, const bool *isnull, bool isleaf)
577577
{
578578
Datum compatt[INDEX_MAX_KEYS];
579579
IndexTuple res;
@@ -594,7 +594,7 @@ gistFormTuple(GISTSTATE *giststate, Relation r,
594594

595595
void
596596
gistCompressValues(GISTSTATE *giststate, Relation r,
597-
Datum *attdata, bool *isnull, bool isleaf, Datum *compatt)
597+
const Datum *attdata, const bool *isnull, bool isleaf, Datum *compatt)
598598
{
599599
int i;
600600

src/backend/access/hash/hashsort.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ _h_spooldestroy(HSpool *hspool)
106106
* spool an index entry into the sort file.
107107
*/
108108
void
109-
_h_spool(HSpool *hspool, ItemPointer self, Datum *values, bool *isnull)
109+
_h_spool(HSpool *hspool, ItemPointer self, const Datum *values, const bool *isnull)
110110
{
111111
tuplesort_putindextuplevalues(hspool->sortstate, hspool->index,
112112
self, values, isnull);

src/backend/access/index/genam.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ IndexScanEnd(IndexScanDesc scan)
175175
*/
176176
char *
177177
BuildIndexValueDescription(Relation indexRelation,
178-
Datum *values, bool *isnull)
178+
const Datum *values, const bool *isnull)
179179
{
180180
StringInfoData buf;
181181
Form_pg_index idxrec;

src/backend/access/spgist/spgutils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ memcpyInnerDatum(void *target, SpGistTypeDesc *att, Datum datum)
788788
*/
789789
Size
790790
SpGistGetLeafTupleSize(TupleDesc tupleDescriptor,
791-
Datum *datums, bool *isnulls)
791+
const Datum *datums, const bool *isnulls)
792792
{
793793
Size size;
794794
Size data_size;
@@ -841,7 +841,7 @@ SpGistGetLeafTupleSize(TupleDesc tupleDescriptor,
841841
*/
842842
SpGistLeafTuple
843843
spgFormLeafTuple(SpGistState *state, ItemPointer heapPtr,
844-
Datum *datums, bool *isnulls)
844+
const Datum *datums, const bool *isnulls)
845845
{
846846
SpGistLeafTuple tup;
847847
TupleDesc tupleDescriptor = state->leafTupDesc;

src/backend/access/table/toast_helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ toast_tuple_cleanup(ToastTupleContext *ttc)
316316
* relation.
317317
*/
318318
void
319-
toast_delete_external(Relation rel, Datum *values, bool *isnull,
319+
toast_delete_external(Relation rel, const Datum *values, const bool *isnull,
320320
bool is_speculative)
321321
{
322322
TupleDesc tupleDesc = rel->rd_att;

src/backend/executor/execIndexing.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ typedef enum
127127
static bool check_exclusion_or_unique_constraint(Relation heap, Relation index,
128128
IndexInfo *indexInfo,
129129
ItemPointer tupleid,
130-
Datum *values, bool *isnull,
130+
const Datum *values, const bool *isnull,
131131
EState *estate, bool newIndex,
132132
CEOUC_WAIT_MODE waitMode,
133133
bool violationOK,
134134
ItemPointer conflictTid);
135135

136-
static bool index_recheck_constraint(Relation index, Oid *constr_procs,
137-
Datum *existing_values, bool *existing_isnull,
138-
Datum *new_values);
136+
static bool index_recheck_constraint(Relation index, const Oid *constr_procs,
137+
const Datum *existing_values, const bool *existing_isnull,
138+
const Datum *new_values);
139139
static bool index_unchanged_by_update(ResultRelInfo *resultRelInfo,
140140
EState *estate, IndexInfo *indexInfo,
141141
Relation indexRelation);
@@ -684,7 +684,7 @@ static bool
684684
check_exclusion_or_unique_constraint(Relation heap, Relation index,
685685
IndexInfo *indexInfo,
686686
ItemPointer tupleid,
687-
Datum *values, bool *isnull,
687+
const Datum *values, const bool *isnull,
688688
EState *estate, bool newIndex,
689689
CEOUC_WAIT_MODE waitMode,
690690
bool violationOK,
@@ -910,7 +910,7 @@ void
910910
check_exclusion_constraint(Relation heap, Relation index,
911911
IndexInfo *indexInfo,
912912
ItemPointer tupleid,
913-
Datum *values, bool *isnull,
913+
const Datum *values, const bool *isnull,
914914
EState *estate, bool newIndex)
915915
{
916916
(void) check_exclusion_or_unique_constraint(heap, index, indexInfo, tupleid,
@@ -924,9 +924,9 @@ check_exclusion_constraint(Relation heap, Relation index,
924924
* exclusion condition against the new_values. Returns true if conflict.
925925
*/
926926
static bool
927-
index_recheck_constraint(Relation index, Oid *constr_procs,
928-
Datum *existing_values, bool *existing_isnull,
929-
Datum *new_values)
927+
index_recheck_constraint(Relation index, const Oid *constr_procs,
928+
const Datum *existing_values, const bool *existing_isnull,
929+
const Datum *new_values)
930930
{
931931
int indnkeyatts = IndexRelationGetNumberOfKeyAttributes(index);
932932
int i;

src/backend/executor/execTuples.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2273,7 +2273,7 @@ begin_tup_output_tupdesc(DestReceiver *dest,
22732273
* write a single tuple
22742274
*/
22752275
void
2276-
do_tup_output(TupOutputState *tstate, Datum *values, bool *isnull)
2276+
do_tup_output(TupOutputState *tstate, const Datum *values, const bool *isnull)
22772277
{
22782278
TupleTableSlot *slot = tstate->slot;
22792279
int natts = slot->tts_tupleDescriptor->natts;

0 commit comments

Comments
 (0)