From 8c0de5c639fd17fb5c5857a3b4e1b9ad42c1b255 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Tue, 21 Nov 2023 12:07:31 -0700 Subject: [PATCH] locale.c: Avoid unnecessary work around localeconv() There are now two different functions that return the values for localeconv(). One is for when the locale is "C"; the other for everything else. The C one returns values that don't need adjusting, so skip that for this case. This commit removes the SvPOK check which was recently added by fe048cfaa3b42320785bd0c34896ac834634db22. It was needed for before we got values when -DNO_LOCALE_MONETARY is specified. Now that we do get those values, the SV always will contain a PV at this point. --- locale.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/locale.c b/locale.c index d5839b131e05..a6368202cf4e 100644 --- a/locale.c +++ b/locale.c @@ -5722,6 +5722,11 @@ S_my_localeconv(pTHX_ const int item) for (unsigned int i = 0; i < 2; i++) { /* Try both types of strings */ + /* The return from this function is already adjusted */ + if (populate[i] == S_populate_hash_from_C_localeconv) { + continue; + } + /* Examine each string */ for (const lconv_offset_t *strp = strings[i]; strp->name; strp++) { const char * name = strp->name; @@ -5729,7 +5734,7 @@ S_my_localeconv(pTHX_ const int item) /* 'value' will contain the string that may need to be marked as * UTF-8 */ SV ** value = hv_fetch(hv, name, strlen(name), true); - if (! value || ! SvPOK(*value)) { + if (value == NULL) { continue; }