Refactor unit conversions code in guc.c

Enterprise / PostgreSQL - Heikki Linnakangas [iki.fi] - 23 February 2015 10:06 UTC

Replace the if-switch-case constructs with two conversion tables, containing all the supported conversions between human-readable unit strings and the base units used in GUC variables. This makes the code easier to read, and makes adding new units simpler.

1b63026 Refactor unit conversions code in guc.c.
src/backend/utils/misc/guc.c | 431 +++++++++++++++++++-----------------------
src/include/utils/guc.h | 2 +
2 files changed, 193 insertions(+), 240 deletions(-)

Upstream: git.postgresql.org


  • Share