Skip to content

Commit

Permalink
locale.c: Avoid unnecessary work around localeconv()
Browse files Browse the repository at this point in the history
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
fe048cf.  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.
  • Loading branch information
khwilliamson committed Nov 22, 2023
1 parent 2f559a6 commit 8c0de5c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion locale.c
Expand Up @@ -5722,14 +5722,19 @@ 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;

/* '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;
}

Expand Down

0 comments on commit 8c0de5c

Please sign in to comment.