public inbox for [email protected]
help / color / mirror / Atom feedFrom: zhanghu <[email protected]>
To: [email protected]
Subject: guc: make dereference style consistent in check_backtrace_functions
Date: Thu, 26 Feb 2026 15:03:23 +0800
Message-ID: <CAB5m2QssN6UO+ckr6ZCcV0A71mKUB6WdiTw1nHo43v4DTW1Dfg@mail.gmail.com> (raw)
Hi,
In check_backtrace_functions(), most accesses to the input string follow
the pattern (*newval)[i]. However, the empty-string check is currently
written as:
if (*newval[0] == '\0')
While functionally correct due to how the compiler handles the
address-of-address context here, this form is semantically misleading. It
relies on implicit operator precedence rather than explicit intent.
The attached patch rewrites it as:
if ((*newval)[0] == '\0')
This change ensures semantic clarity and maintains a consistent
dereferencing style throughout the function. No functional changes are
introduced.
Regards,
Zhang Hu
Attachments:
[application/octet-stream] v1-0001-guc-make-dereference-style-consistent-in-check_ba.patch (1.2K, 3-v1-0001-guc-make-dereference-style-consistent-in-check_ba.patch)
download | inline diff:
From 85919fa8f4500be466dbc2e0a37072e1b8732700 Mon Sep 17 00:00:00 2001
From: zhanghu <[email protected]>
Date: Thu, 26 Feb 2026 14:54:22 +0800
Subject: [PATCH v1] guc: make dereference style consistent in
check_backtrace_functions
In check_backtrace_functions(), the empty-string check is currently
implemented as:
if (*newval[0] == '\0')
while the rest of the function consistently accesses the string as
(*newval)[i]
This patch rewrites the check as:
if ((*newval)[0] == '\0')
This change ensures semantic clarity and maintains a consistent
dereferencing style throughout the function. No functional changes
are introduced.
Author: zhanghu <[email protected]>
---
src/backend/utils/error/elog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 0d0bf0f6aa5..650a79b7e12 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -2627,7 +2627,7 @@ check_backtrace_functions(char **newval, void **extra, GucSource source)
return false;
}
- if (*newval[0] == '\0')
+ if ((*newval)[0] == '\0')
{
*extra = NULL;
return true;
--
2.33.0
view thread (3+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: guc: make dereference style consistent in check_backtrace_functions
In-Reply-To: <CAB5m2QssN6UO+ckr6ZCcV0A71mKUB6WdiTw1nHo43v4DTW1Dfg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox