v1-0005-formatting.c-cleanup-Use-array-syntax-instead-of-.patch
text/plain
Filename: v1-0005-formatting.c-cleanup-Use-array-syntax-instead-of-.patch
Type: text/plain
Part: 4
Message:
formatting.c cleanup
Patch
Format: format-patch
Series: patch v1-0005
Subject: formatting.c cleanup: Use array syntax instead of pointer arithmetic
| File | + | − |
|---|---|---|
| src/backend/utils/adt/formatting.c | 3 | 3 |
From 1f75a3249aff857049f29bbdf45d79ac0116a8a8 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Mon, 20 Oct 2025 08:16:03 +0200
Subject: [PATCH v1 05/13] formatting.c cleanup: Use array syntax instead of
pointer arithmetic
for easier readability
---
src/backend/utils/adt/formatting.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index d949153dfb4..0671acf2874 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -1109,7 +1109,7 @@ index_seq_search(const char *str, const KeyWord *kw, const int *index)
if (!KeyWord_INDEX_FILTER(*str))
return NULL;
- if ((poz = *(index + (*str - ' '))) > -1)
+ if ((poz = index[*str - ' ']) > -1)
{
const KeyWord *k = kw + poz;
@@ -1531,7 +1531,7 @@ get_th(const char *num, int type)
Assert(len > 0);
- last = *(num + (len - 1));
+ last = num[len - 1];
if (!isdigit((unsigned char) last))
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@@ -4807,7 +4807,7 @@ static char *
fill_str(char *str, int c, size_t maxlen)
{
memset(str, c, maxlen);
- *(str + maxlen) = '\0';
+ str[maxlen] = '\0';
return str;
}
--
2.51.0