Remove meaningless const qualifier from ginCompressPostingList()

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Remove meaningless const qualifier from ginCompressPostingList()
Date: 2025-10-29 03:42:42
Message-ID: CAEoWx2kTDz=b6T2xHX78vy_B_osDeCC5dcTCi9eG0vXHp5QpdQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hacker,

While working on the other patch that fixed wrong "const" usage [1], I
found the function:
```
GinPostingList *
ginCompressPostingList(const ItemPointer ipd, int nipd, int maxsize,
int *nwritten)
```
uses "const" unnecessarily. Because it needs to assign an element of "ipd"
to the returned structure "GinPostingList->first" and "first" is a mutable
"ItemPointerData *", so that "ipd" cannot be of const pointer.

With the current usage, "const" only protects "ipd" itself from updating,
which is meaningless. Thus the "const" only adds confusion to code readers,
so I am deleting it.

https://www.postgresql.org/message-id/CAEoWx2m2E0xE8Kvbkv31ULh_E%2B5zph-WA_bEdv3UR9CLhw%2B3vg%40mail.gmail.com

Chao Li (Evan)
---------------------
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachment Content-Type Size
v1-0001-Remove-meaningless-const-qualifier-from-ginCompre.patch application/octet-stream 1.9 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2025-10-29 03:43:47 Re: Report bytes and transactions actually sent downtream
Previous Message Chao Li 2025-10-29 03:11:05 Fix incorrect const qualification for tbm_add_tuples() and itemptr_to_uint64()