public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tatsuo Ishii <[email protected]>
To: [email protected]
Subject: Refactor BackendFlagsShowFunc()
Date: Mon, 08 Dec 2025 18:23:18 +0900 (JST)
Message-ID: <[email protected]> (raw)
Currently BackendFlagsShowFunc() and pool_flag_to_str() use almost
identical codes. To avoid the duplication, I would like to propose to
let BackendFlagsShowFunc() to call pool_flag_to_str(). Patch attached.
Best regards,
--
Tatsuo Ishii
SRA OSS K.K.
English: http://www.sraoss.co.jp/index_en/
Japanese:http://www.sraoss.co.jp
Attachments:
[application/octet-stream] v1-0001-Refactor-BackendFlagsShowFunc.patch (1.4K, 2-v1-0001-Refactor-BackendFlagsShowFunc.patch)
download | inline diff:
From 38fd3c142768b0966ea26d2fe147762f54659666 Mon Sep 17 00:00:00 2001
From: Tatsuo Ishii <[email protected]>
Date: Mon, 8 Dec 2025 18:17:30 +0900
Subject: [PATCH v1] Refactor BackendFlagsShowFunc().
BackendFlagsShowFunc() and pool_flag_to_str() use almost identical
codes. To avoid the duplication, let BackendFlagsShowFunc() to call
pool_flag_to_str().
---
src/config/pool_config_variables.c | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/src/config/pool_config_variables.c b/src/config/pool_config_variables.c
index e58771b25..f0e88f351 100644
--- a/src/config/pool_config_variables.c
+++ b/src/config/pool_config_variables.c
@@ -4551,25 +4551,8 @@ BackendDataDirShowFunc(int index)
static const char *
BackendFlagsShowFunc(int index)
{
- static char buffer[1024];
-
unsigned short flag = g_pool_config.backend_desc->backend_info[index].flag;
-
- *buffer = '\0';
-
- if (POOL_ALLOW_TO_FAILOVER(flag))
- snprintf(buffer, sizeof(buffer), "ALLOW_TO_FAILOVER");
- else if (POOL_DISALLOW_TO_FAILOVER(flag))
- snprintf(buffer, sizeof(buffer), "DISALLOW_TO_FAILOVER");
-
- if (POOL_ALWAYS_PRIMARY & flag)
- {
- if (*buffer == '\0')
- snprintf(buffer, sizeof(buffer), "ALWAYS_PRIMARY");
- else
- strncat(buffer, "|ALWAYS_PRIMARY", 16);
- }
- return buffer;
+ return pool_flag_to_str(flag);
}
static const char *
--
2.43.0
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: Refactor BackendFlagsShowFunc()
In-Reply-To: <[email protected]>
* 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