| From: | Jeff Davis <pgsql(at)j-davis(dot)com> |
|---|---|
| To: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
| Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Remaining dependency on setlocale() |
| Date: | 2025-11-25 17:20:01 |
| Message-ID: | 78edc741a168c54d57cc898a5877b6443527a2c8.camel@j-davis.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, 2025-11-25 at 09:44 +0800, Chao Li wrote:
> I was curious why “inline” is needed, then I figured out when I tried
> to build. Without “inline”, compile will raise warnings of “unused
> function”. So I guess it’s better to explain why “inline” is used in
> the function comment, otherwise other readers may get the same
> confusion.
That's a typical pattern: to make it "inline", move it to a .h file and
declare it as "static inline". For common patterns like that, I don't
think we should explain them in comments, because it would mean we
would start adding comments in zillions of places.
> With “change in length”, I confirmed “Unicode 5.18.2” means the
> Unicode Standard Section 5.18.2 “Complications for Case Mapping”. Why
> don’t we just give the URL in the comment.
> https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-5/#G29675
Done, thank you. (Though since we haven't actually moved to 17 yet, I
linked to 16 instead.)
> I don’t get this change. In old code, depending on locale->ctype-
> >strfold, it calls strfold or strlower. But in this patch, it only
> calls strfold. Why? If that’s intentional, maybe better to add a
> comment to explain that.
I thought it would be slightly cleaner to just define the strfold
method in the libc provider as the same as strlower. I agree it's worth
a comment, so I added some in pg_locale_libc.c.
> In pg_strfold, the ctype==NULL fallback code is exactly the same as
> pg_strlower. I guess you intentionally to not call pg_strlower here
> for performance consideration, is that true?
I made some static functions to clean that up, and added some comments.
Thank you.
New series attached with only these changes and a rebase.
Regards,
Jeff Davis
| Attachment | Content-Type | Size |
|---|---|---|
| v10-0001-Inline-pg_ascii_tolower-and-pg_ascii_toupper.patch | text/x-patch | 2.5 KB |
| v10-0002-Add-define-for-UNICODE_CASEMAP_BUFSZ.patch | text/x-patch | 1.4 KB |
| v10-0003-Change-some-callers-to-use-pg_ascii_toupper.patch | text/x-patch | 1.5 KB |
| v10-0004-Allow-pg_locale_t-APIs-to-work-when-ctype_is_c.patch | text/x-patch | 7.8 KB |
| v10-0005-Make-regex-max_chr-depend-on-encoding-not-provid.patch | text/x-patch | 3.1 KB |
| v10-0006-Fix-inconsistency-between-ltree_strncasecmp-and-.patch | text/x-patch | 3.5 KB |
| v10-0007-Remove-char_tolower-API.patch | text/x-patch | 9.2 KB |
| v10-0008-Use-multibyte-aware-extraction-of-pattern-prefix.patch | text/x-patch | 11.6 KB |
| v10-0009-fuzzystrmatch-use-pg_ascii_toupper.patch | text/x-patch | 3.2 KB |
| v10-0010-downcase_identifier-use-method-table-from-locale.patch | text/x-patch | 11.5 KB |
| v10-0011-Control-LC_COLLATE-with-GUC.patch | text/x-patch | 7.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2025-11-25 17:35:52 | Re: The pgperltidy diffs in HEAD |
| Previous Message | Jacob Champion | 2025-11-25 17:19:29 | Re: [oauth] SASL mechanisms |