Fix misuse of "const" qualifier.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 14 Feb 2022 00:11:21 +0000 (19:11 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 14 Feb 2022 00:20:56 +0000 (19:20 -0500)
"const foo *" is quite different from "foo * const".
This code was evidently trying to avoid casting away
const from the arguments, but entirely failed to do so.

Per study of some buildfarm warnings from anole
(which unfortunately are mostly ignorable, since it
seems not to understand "restrict" very well).
I'm surprised though that nothing else has complained.

src/backend/partitioning/partbounds.c

index 8838763715dbbdeb2fd6e43f2092351cc3a3c4ff..6b35111ebb6fcdb081b6191c9a1e655dfe4dc6be 100644 (file)
@@ -3793,8 +3793,8 @@ partition_hash_bsearch(PartitionBoundInfo boundinfo,
 static int32
 qsort_partition_hbound_cmp(const void *a, const void *b)
 {
-   PartitionHashBound *const h1 = (PartitionHashBound *const) a;
-   PartitionHashBound *const h2 = (PartitionHashBound *const) b;
+   const PartitionHashBound *h1 = (const PartitionHashBound *) a;
+   const PartitionHashBound *h2 = (const PartitionHashBound *) b;
 
    return partition_hbound_cmp(h1->modulus, h1->remainder,
                                h2->modulus, h2->remainder);
@@ -3808,8 +3808,8 @@ qsort_partition_hbound_cmp(const void *a, const void *b)
 static int32
 qsort_partition_list_value_cmp(const void *a, const void *b, void *arg)
 {
-   Datum       val1 = ((PartitionListValue *const) a)->value,
-               val2 = ((PartitionListValue *const) b)->value;
+   Datum       val1 = ((const PartitionListValue *) a)->value,
+               val2 = ((const PartitionListValue *) b)->value;
    PartitionKey key = (PartitionKey) arg;
 
    return DatumGetInt32(FunctionCall2Coll(&key->partsupfunc[0],