formatting.c cleanup

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-10-20T09:50:14Z
Lists: pgsql-hackers

Attachments

The file formatting.c contains some hard to read and understand code. 
For the attached patch series, I made a few more or less mechanical 
passes over it to modernize the code a bit, renamed some symbols to be 
clearer, adjusted some types to make things more self-documenting, 
removed some redundant code to make some things more compact.  I hope 
this helps a bit.

Commits

  1. formatting.c cleanup: Change fill_str() return type to void

  2. formatting.c cleanup: Change TmFromChar.clock field to bool

  3. formatting.c cleanup: Change several int fields to enums

  4. formatting.c cleanup: Rename DCH_S_* to DCH_SUFFIX_*

  5. formatting.c cleanup: Improve formatting of some struct declarations

  6. formatting.c cleanup: Remove unnecessary zeroize macros

  7. formatting.c cleanup: Remove unnecessary extra line breaks in error message literals

  8. formatting.c cleanup: Remove unnecessary extra parentheses

  9. formatting.c cleanup: Use array syntax instead of pointer arithmetic

  10. formatting.c cleanup: Add some const pointer qualifiers

  11. formatting.c cleanup: Use size_t for string length variables and arguments

  12. formatting.c cleanup: Move loop variables definitions into for statement

  13. formatting.c cleanup: Remove dashes in comments