Improve readability by using designated initializers when possible

From: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Improve readability by using designated initializers when possible
Date: 2024-02-21 15:03:31
Message-ID: CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Usage of designated initializers came up in:
https://www.postgresql.org/message-id/flat/ZdWXhAt9Tz4d-lut%40paquier.xyz#9dc17e604e58569ad35643672bf74acc

This converts all arrays that I could find that could clearly benefit
from this without any other code changes being necessary.

There were a few arrays that I didn't convert that seemed like they
could be useful to convert, but where the variables started counting
at 1. So by converting them elements the array would grow and elements
would be shifted by one. Changing those might be nice, but would
require some more code changes so I didn't want to combine it with
these simpler refactors. The arrays I'm talking about were
specifically tsearch_op_priority, BT_implies_table, BT_refutes_table,
and BT_implic_table.

Attachment Content-Type Size
v1-0001-Use-designated-initializer-syntax-to-improve-read.patch application/octet-stream 36.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Maxim Orlov 2024-02-21 15:08:54 Re: POC: GROUP BY optimization
Previous Message Jacob Champion 2024-02-21 14:50:21 Re: WIP Incremental JSON Parser