Skip to content

Commit

Permalink
locale: make PL_langinfo_buf const *
Browse files Browse the repository at this point in the history
The previous commit allows this change to be made.
  • Loading branch information
khwilliamson committed Aug 10, 2022
1 parent 3cb5656 commit fedbe6e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion intrpvar.h
Expand Up @@ -757,7 +757,7 @@ PERLVARI(I, collation_standard, bool, TRUE)
/* Assume simple collation */
#endif /* USE_LOCALE_COLLATE */

PERLVARI(I, langinfo_buf, char *, NULL)
PERLVARI(I, langinfo_buf, const char *, NULL)
PERLVARI(I, langinfo_bufsize, Size_t, 0)
PERLVARI(I, setlocale_buf, const char *, NULL)
PERLVARI(I, setlocale_bufsize, Size_t, 0)
Expand Down
22 changes: 6 additions & 16 deletions locale.c
Expand Up @@ -3145,9 +3145,7 @@ S_my_langinfo(const nl_item item, bool toggle)
/* Copy to a per-thread buffer, which is also one that won't be
* destroyed by a subsequent setlocale(), such as the
* RESTORE_LC_NUMERIC may do just below. */
retval = save_to_buffer(nl_langinfo(item),
((const char **) &PL_langinfo_buf),
&PL_langinfo_bufsize);
retval = save_to_buffer(nl_langinfo(item), &PL_langinfo_buf, &PL_langinfo_bufsize);
NL_LANGINFO_UNLOCK;

if (toggle) {
Expand Down Expand Up @@ -3176,9 +3174,7 @@ S_my_langinfo(const nl_item item, bool toggle)

/* We have to save it to a buffer, because the freelocale() just below
* can invalidate the internal one */
retval = save_to_buffer(nl_langinfo_l(item, cur),
((const char **) &PL_langinfo_buf),
&PL_langinfo_bufsize);
retval = save_to_buffer(nl_langinfo_l(item, cur), &PL_langinfo_buf, &PL_langinfo_bufsize);
}

# endif
Expand Down Expand Up @@ -3264,8 +3260,7 @@ S_my_langinfo(const nl_item item, bool toggle)
: '+';

retval = save_to_buffer(Perl_form(aTHX_ "%c%s", precedes, currency),
((const char **) &PL_langinfo_buf),
&PL_langinfo_bufsize);
&PL_langinfo_buf, &PL_langinfo_bufsize);
}

# ifdef TS_W32_BROKEN_LOCALECONV
Expand Down Expand Up @@ -3402,9 +3397,7 @@ S_my_langinfo(const nl_item item, bool toggle)
}
}

retval = save_to_buffer(temp,
((const char **) &PL_langinfo_buf),
&PL_langinfo_bufsize);
retval = save_to_buffer(temp, &PL_langinfo_buf, &PL_langinfo_bufsize);

# ifdef TS_W32_BROKEN_LOCALECONV

Expand Down Expand Up @@ -3533,8 +3526,7 @@ S_my_langinfo(const nl_item item, bool toggle)
* time, it all works */
const char * temp = my_strftime(format, 30, 30, hour, mday, mon,
2011, 0, 0, 0);
retval = save_to_buffer(temp, (const char **) &PL_langinfo_buf,
&PL_langinfo_bufsize);
retval = save_to_buffer(temp, &PL_langinfo_buf, &PL_langinfo_bufsize);
Safefree(temp);

/* If the item is 'ALT_DIGITS', 'PL_langinfo_buf' contains the
Expand Down Expand Up @@ -3613,9 +3605,7 @@ S_my_langinfo(const nl_item item, bool toggle)
/* Use everything past the dot */
retval++;

retval = save_to_buffer(retval,
((const char **) &PL_langinfo_buf),
&PL_langinfo_bufsize);
retval = save_to_buffer(retval, &PL_langinfo_buf, &PL_langinfo_bufsize);
}

break;
Expand Down

0 comments on commit fedbe6e

Please sign in to comment.