Missing const in DSA.
While looking at some of the recent churn in DSA I noticed that
dsa_size_class_map should probably be declared const.
Attachments:
dsa-size-map-const.patchtext/x-patch; charset=US-ASCII; name=dsa-size-map-const.patchDownload
diff --git a/src/backend/utils/mmgr/dsa.c b/src/backend/utils/mmgr/dsa.c
index 33ab8d05d3..70ce7ce7da 100644
--- a/src/backend/utils/mmgr/dsa.c
+++ b/src/backend/utils/mmgr/dsa.c
@@ -256,7 +256,7 @@ static const uint16 dsa_size_classes[] = {
* round the size of the object up to the next multiple of 8 bytes, and then
* index into this array.
*/
-static char dsa_size_class_map[] = {
+static const char dsa_size_class_map[] = {
2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 11, 12, 12, 13, 13,
14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17,
18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19,
Mark G <markg735@gmail.com> writes:
While looking at some of the recent churn in DSA I noticed that
dsa_size_class_map should probably be declared const.
+1 ... also, given the contents of the array, "char" seems like
rather a misnomer. I'd be happier if it were declared as uint8, say.
regards, tom lane
On Mon, Sep 24, 2018 at 9:32 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Mark G <markg735@gmail.com> writes:
While looking at some of the recent churn in DSA I noticed that
dsa_size_class_map should probably be declared const.+1 ... also, given the contents of the array, "char" seems like
rather a misnomer. I'd be happier if it were declared as uint8, say.
+1
--
Thomas Munro
http://www.enterprisedb.com
Thomas Munro <thomas.munro@enterprisedb.com> writes:
On Mon, Sep 24, 2018 at 9:32 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Mark G <markg735@gmail.com> writes:
While looking at some of the recent churn in DSA I noticed that
dsa_size_class_map should probably be declared const.
+1 ... also, given the contents of the array, "char" seems like
rather a misnomer. I'd be happier if it were declared as uint8, say.
+1
Are you planning to take care of this?
regards, tom lane
On Tue, Sep 25, 2018 at 4:17 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Thomas Munro <thomas.munro@enterprisedb.com> writes:
On Mon, Sep 24, 2018 at 9:32 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Mark G <markg735@gmail.com> writes:
While looking at some of the recent churn in DSA I noticed that
dsa_size_class_map should probably be declared const.+1 ... also, given the contents of the array, "char" seems like
rather a misnomer. I'd be happier if it were declared as uint8, say.+1
Are you planning to take care of this?
Will do.
--
Thomas Munro
http://www.enterprisedb.com
On Tue, Sep 25, 2018 at 7:46 AM Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
On Tue, Sep 25, 2018 at 4:17 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Thomas Munro <thomas.munro@enterprisedb.com> writes:
On Mon, Sep 24, 2018 at 9:32 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Mark G <markg735@gmail.com> writes:
While looking at some of the recent churn in DSA I noticed that
dsa_size_class_map should probably be declared const.+1 ... also, given the contents of the array, "char" seems like
rather a misnomer. I'd be happier if it were declared as uint8, say.
Pushed. Thanks both for the code review!
--
Thomas Munro
http://www.enterprisedb.com