agora inbox for [email protected]help / color / mirror / Atom feed
[PATCH 1/2] simplify coding in check_log_min_messages 50+ messages / 2 participants [nested] [flat]
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH 1/2] simplify coding in check_log_min_messages @ 2026-02-17 15:33 Álvaro Herrera <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Álvaro Herrera @ 2026-02-17 15:33 UTC (permalink / raw) --- src/backend/utils/error/elog.c | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index b9d2c96b97a..80d4eef755a 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -193,6 +193,7 @@ static pg_noinline void set_backtrace(ErrorData *edata, int num_skip); static void backtrace_cleanup(int code, Datum arg); static void set_errdata_field(MemoryContextData *cxt, char **ptr, const char *str); static void FreeErrorDataContents(ErrorData *edata); +static int parse_message_level(const char *level); static int log_min_messages_cmp(const ListCell *a, const ListCell *b); static void write_console(const char *line, int len); static const char *process_log_prefix_padding(const char *p, int *ppadding); @@ -2403,9 +2404,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) */ if (sep == NULL) { - const struct config_enum_entry *entry; - bool found; - /* Reject duplicates for default log level. */ if (defaultlevel != -1) { @@ -2414,18 +2412,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) } /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, elem) == 0) - { - defaultlevel = entry->val; - found = true; - break; - } - } - - if (!found) + if ((defaultlevel = parse_message_level(elem)) == 0) { GUC_check_errdetail("Unrecognized log level: \"%s\".", elem); goto lmm_fail; @@ -2437,7 +2424,6 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *ptype = elem; bool found; int level; - const struct config_enum_entry *entry; /* * Temporarily clobber the ':' with a string terminator, so that @@ -2446,18 +2432,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) *sep = '\0'; /* Validate the log level */ - found = false; - for (entry = server_message_level_options; entry && entry->name; entry++) - { - if (pg_strcasecmp(entry->name, loglevel) == 0) - { - level = entry->val; - found = true; - break; - } - } - - if (!found) + if ((level = parse_message_level(loglevel)) == 0) { GUC_check_errdetail("Unrecognized log level for process type \"%s\": \"%s\".", ptype, loglevel); @@ -2566,6 +2541,22 @@ lmm_fail: return true; } +/* + * Recognize the given string as a message level (for log_min_messages), and + * return its value if successful. Otherwise, return 0. + */ +static int +parse_message_level(const char *level) +{ + const struct config_enum_entry *entry; + + for (entry = server_message_level_options; entry && entry->name; entry++) + if (pg_strcasecmp(entry->name, level) == 0) + return entry->val; + + return 0; +} + /* * list_sort() callback for check_log_min_messages. The default element * goes first; the rest are ordered by strcmp() of the process type. -- 2.47.3 --dnohjpfxulhc3bo3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-memory-free-simplify.patch ^ permalink raw reply [nested|flat] 50+ messages in thread
* [PATCH v1 2/2] run pgindent @ 2026-05-05 21:04 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 50+ messages in thread From: Nathan Bossart @ 2026-05-05 21:04 UTC (permalink / raw) --- src/backend/replication/logical/logicalfuncs.c | 2 +- src/backend/storage/ipc/dsm_registry.c | 2 +- src/bin/pg_basebackup/pg_basebackup.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/replication/logical/logicalfuncs.c b/src/backend/replication/logical/logicalfuncs.c index 512013b0ef0..71fbaf72269 100644 --- a/src/backend/replication/logical/logicalfuncs.c +++ b/src/backend/replication/logical/logicalfuncs.c @@ -218,7 +218,7 @@ pg_logical_slot_get_changes_guts(FunctionCallInfo fcinfo, bool confirm, bool bin * what we need. */ if (!binary && - ctx->options.output_type !=OUTPUT_PLUGIN_TEXTUAL_OUTPUT) + ctx->options.output_type != OUTPUT_PLUGIN_TEXTUAL_OUTPUT) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("logical decoding output plugin \"%s\" produces binary output, but function \"%s\" expects textual data", diff --git a/src/backend/storage/ipc/dsm_registry.c b/src/backend/storage/ipc/dsm_registry.c index 2b56977659b..b9961c26019 100644 --- a/src/backend/storage/ipc/dsm_registry.c +++ b/src/backend/storage/ipc/dsm_registry.c @@ -479,7 +479,7 @@ pg_get_dsm_registry_allocations(PG_FUNCTION_ARGS) entry->dsa.handle != DSA_HANDLE_INVALID) vals[2] = Int64GetDatum(dsa_get_total_size_from_handle(entry->dsa.handle)); else if (entry->type == DSMR_ENTRY_TYPE_DSH && - entry->dsh.dsa_handle !=DSA_HANDLE_INVALID) + entry->dsh.dsa_handle != DSA_HANDLE_INVALID) vals[2] = Int64GetDatum(dsa_get_total_size_from_handle(entry->dsh.dsa_handle)); else nulls[2] = true; diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index c1a4672aa6f..80dc3bbc8da 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -1282,7 +1282,7 @@ ReceiveArchiveStream(PGconn *conn, pg_compress_specification *compress) ReceiveCopyData(conn, ReceiveArchiveStreamChunk, &state); /* If we wrote the backup manifest to a file, close the file. */ - if (state.manifest_file !=NULL) + if (state.manifest_file != NULL) { fclose(state.manifest_file); state.manifest_file = NULL; @@ -1341,7 +1341,7 @@ ReceiveArchiveStreamChunk(size_t r, char *copybuf, void *callback_data) /* Sanity check. */ if (state->manifest_buffer != NULL || - state->manifest_file !=NULL) + state->manifest_file != NULL) pg_fatal("archives must precede manifest"); /* Parse the rest of the CopyData message. */ @@ -1406,7 +1406,7 @@ ReceiveArchiveStreamChunk(size_t r, char *copybuf, void *callback_data) appendPQExpBuffer(state->manifest_buffer, copybuf + 1, r - 1); } - else if (state->manifest_file !=NULL) + else if (state->manifest_file != NULL) { /* Manifest data, write to disk. */ if (fwrite(copybuf + 1, r - 1, 1, -- 2.50.1 (Apple Git-155) --k2Vi/uo5iFea1Gni-- ^ permalink raw reply [nested|flat] 50+ messages in thread
end of thread, other threads:[~2026-05-05 21:04 UTC | newest] Thread overview: 50+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-02-17 15:33 [PATCH 1/2] simplify coding in check_log_min_messages Álvaro Herrera <[email protected]> 2026-05-05 21:04 [PATCH v1 2/2] run pgindent Nathan Bossart <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox