mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Fix some confusing uses of const
There are a few places where we have
typedef struct FooData { ... } FooData;
typedef FooData *Foo;
and then function declarations with
bar(const Foo x)
which isn't incorrect but probably meant
bar(const FooData *x)
meaning that the thing x points to is immutable, not x itself.
This patch makes those changes where appropriate. In one
case (execGrouping.c), the thing being pointed to was not immutable,
so in that case remove the const altogether, to avoid further
confusion.
Co-authored-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAEoWx2m2E0xE8Kvbkv31ULh_E%2B5zph-WA_bEdv3UR9CLhw%2B3vg%40mail.gmail.com
Discussion: https://www.postgresql.org/message-id/CAEoWx2kTDz%3Db6T2xHX78vy_B_osDeCC5dcTCi9eG0vXHp5QpdQ%40mail.gmail.com
This commit is contained in:
@@ -75,7 +75,7 @@ static bool TS_execute_locations_recurse(QueryItem *curitem,
|
||||
void *arg,
|
||||
TSExecuteCallback chkcond,
|
||||
List **locations);
|
||||
static int tsvector_bsearch(const TSVector tsv, char *lexeme, int lexeme_len);
|
||||
static int tsvector_bsearch(const TSVectorData *tsv, char *lexeme, int lexeme_len);
|
||||
static Datum tsvector_update_trigger(PG_FUNCTION_ARGS, bool config_column);
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ static Datum tsvector_update_trigger(PG_FUNCTION_ARGS, bool config_column);
|
||||
* Order: haspos, len, word, for all positions (pos, weight)
|
||||
*/
|
||||
static int
|
||||
silly_cmp_tsvector(const TSVector a, const TSVector b)
|
||||
silly_cmp_tsvector(const TSVectorData *a, const TSVectorData *b)
|
||||
{
|
||||
if (VARSIZE(a) < VARSIZE(b))
|
||||
return -1;
|
||||
@@ -95,8 +95,8 @@ silly_cmp_tsvector(const TSVector a, const TSVector b)
|
||||
return 1;
|
||||
else
|
||||
{
|
||||
WordEntry *aptr = ARRPTR(a);
|
||||
WordEntry *bptr = ARRPTR(b);
|
||||
const WordEntry *aptr = ARRPTR(a);
|
||||
const WordEntry *bptr = ARRPTR(b);
|
||||
int i = 0;
|
||||
int res;
|
||||
|
||||
@@ -397,9 +397,9 @@ add_pos(TSVector src, WordEntry *srcptr,
|
||||
* found.
|
||||
*/
|
||||
static int
|
||||
tsvector_bsearch(const TSVector tsv, char *lexeme, int lexeme_len)
|
||||
tsvector_bsearch(const TSVectorData *tsv, char *lexeme, int lexeme_len)
|
||||
{
|
||||
WordEntry *arrin = ARRPTR(tsv);
|
||||
const WordEntry *arrin = ARRPTR(tsv);
|
||||
int StopLow = 0,
|
||||
StopHigh = tsv->size,
|
||||
StopMiddle,
|
||||
|
||||
Reference in New Issue
Block a user