public inbox for [email protected]
help / color / mirror / Atom feedsmall cleanup patches for collation code
2+ messages / 2 participants
[nested] [flat]
* small cleanup patches for collation code
@ 2026-04-17 19:30 Jeff Davis <[email protected]>
2026-04-25 06:12 ` Re: small cleanup patches for collation code Peter Eisentraut <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Davis @ 2026-04-17 19:30 UTC (permalink / raw)
To: pgsql-hackers
Two patches attached.
0001 fixes a style issue. Backport because it eliminates a warning in
the 'update-unicode' target.
0002 looks like a bug, but is not a real issue because there are no
callers that pass srclen==-1, aside from a test (which fails to fail).
So it's just cleanup, but it seems worth backporting.
Regards,
Jeff Davis
Attachments:
[text/x-patch] v1-0001-style-define-parameterless-functions-as-foo-void.patch (1.3K, 2-v1-0001-style-define-parameterless-functions-as-foo-void.patch)
download | inline diff:
From 4673d8c7a31b24970e6371c4f2fb3a5e099409dc Mon Sep 17 00:00:00 2001
From: Jeff Davis <[email protected]>
Date: Thu, 16 Apr 2026 16:30:06 -0700
Subject: [PATCH v1 1/2] style: define parameterless functions as foo(void).
Avoids warning in 'update-unicode' build target. Similar to
11171fe1fc.
Backpatch-through: 17
---
src/common/unicode/case_test.c | 2 +-
src/common/unicode/category_test.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/common/unicode/case_test.c b/src/common/unicode/case_test.c
index fb159c1c27c..e34f700d9c4 100644
--- a/src/common/unicode/case_test.c
+++ b/src/common/unicode/case_test.c
@@ -329,7 +329,7 @@ tfunc_fold(char *dst, size_t dstsize, const char *src,
}
static void
-test_convert_case()
+test_convert_case(void)
{
/* test string with no case changes */
test_convert(tfunc_lower, "√∞", "√∞");
diff --git a/src/common/unicode/category_test.c b/src/common/unicode/category_test.c
index 2b422001209..ffb9d42d704 100644
--- a/src/common/unicode/category_test.c
+++ b/src/common/unicode/category_test.c
@@ -54,7 +54,7 @@ parse_unicode_version(const char *version)
* White_Space, and Hex_Digit.
*/
static void
-icu_test()
+icu_test(void)
{
int successful = 0;
int pg_skipped_codepoints = 0;
--
2.43.0
[text/x-patch] v1-0002-Fix-callers-of-unicode_strtitle-using-srclen-1.patch (1.4K, 3-v1-0002-Fix-callers-of-unicode_strtitle-using-srclen-1.patch)
download | inline diff:
From b104c64e5572b04622c11883d2a82e579d134944 Mon Sep 17 00:00:00 2001
From: Jeff Davis <[email protected]>
Date: Thu, 16 Apr 2026 16:20:02 -0700
Subject: [PATCH v1 2/2] Fix callers of unicode_strtitle() using srclen == -1.
Currently, only called that way in tests, which failed to fail.
Backpatch-through: 18
---
src/backend/utils/adt/pg_locale_builtin.c | 2 +-
src/common/unicode/case_test.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/backend/utils/adt/pg_locale_builtin.c b/src/backend/utils/adt/pg_locale_builtin.c
index b5aeb7a337a..794aa37df76 100644
--- a/src/backend/utils/adt/pg_locale_builtin.c
+++ b/src/backend/utils/adt/pg_locale_builtin.c
@@ -97,7 +97,7 @@ strtitle_builtin(char *dest, size_t destsize, const char *src, ssize_t srclen,
{
struct WordBoundaryState wbstate = {
.str = src,
- .len = srclen,
+ .len = (srclen < 0) ? strlen(src) : srclen,
.offset = 0,
.posix = !locale->builtin.casemap_full,
.init = false,
diff --git a/src/common/unicode/case_test.c b/src/common/unicode/case_test.c
index e34f700d9c4..099530c1ead 100644
--- a/src/common/unicode/case_test.c
+++ b/src/common/unicode/case_test.c
@@ -304,7 +304,7 @@ tfunc_title(char *dst, size_t dstsize, const char *src,
{
struct WordBoundaryState wbstate = {
.str = src,
- .len = srclen,
+ .len = (srclen < 0) ? strlen(src) : srclen,
.offset = 0,
.init = false,
.prev_alnum = false,
--
2.43.0
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: small cleanup patches for collation code
2026-04-17 19:30 small cleanup patches for collation code Jeff Davis <[email protected]>
@ 2026-04-25 06:12 ` Peter Eisentraut <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Peter Eisentraut @ 2026-04-25 06:12 UTC (permalink / raw)
To: Jeff Davis <[email protected]>; pgsql-hackers
On 17.04.26 21:30, Jeff Davis wrote:
> Two patches attached.
>
> 0001 fixes a style issue. Backport because it eliminates a warning in
> the 'update-unicode' target.
These warning options were only added in PG19, so backpatching is not
necessary.
> 0002 looks like a bug, but is not a real issue because there are no
> callers that pass srclen==-1, aside from a test (which fails to fail).
> So it's just cleanup, but it seems worth backporting.
That looks right.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-04-25 06:12 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-04-17 19:30 small cleanup patches for collation code Jeff Davis <[email protected]>
2026-04-25 06:12 ` Peter Eisentraut <[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