Skip to content

Commit

Permalink
Make three locale PL_ strings const char*
Browse files Browse the repository at this point in the history
This adds some compile safety to these.
  • Loading branch information
khwilliamson committed May 9, 2021
1 parent 783c770 commit 6a6d2de
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion embed.fnc
Expand Up @@ -3225,7 +3225,7 @@ ST |const char*|my_nl_langinfo|const nl_item item|bool toggle
ST |const char*|my_nl_langinfo|const int item|bool toggle
# endif
iTR |const char *|save_to_buffer|NULLOK const char * string \
|NULLOK char **buf \
|NULLOK const char **buf \
|NN Size_t *buf_size \
|const Size_t offset
# if defined(USE_LOCALE)
Expand Down
6 changes: 3 additions & 3 deletions intrpvar.h
Expand Up @@ -741,9 +741,9 @@ 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, char *, NULL)
PERLVARI(I, setlocale_buf, const char *, NULL)
PERLVARI(I, setlocale_bufsize, Size_t, 0)

#ifdef PERL_SAWAMPERSAND
Expand Down Expand Up @@ -802,7 +802,7 @@ PERLVARI(I, numeric_underlying_is_standard, bool, TRUE)

PERLVARI(I, numeric_standard, int, TRUE)
/* Assume C locale numerics */
PERLVAR(I, numeric_name, char *) /* Name of current numeric locale */
PERLVAR(I, numeric_name, const char *) /* Name of current numeric locale */
PERLVAR(I, numeric_radix_sv, SV *) /* The radix separator if not '.' */

# ifdef USE_POSIX_2008_LOCALE
Expand Down
2 changes: 1 addition & 1 deletion locale.c
Expand Up @@ -2336,7 +2336,7 @@ Perl_setlocale(const int category, const char * locale)
}

PERL_STATIC_INLINE const char *
S_save_to_buffer(const char * string, char **buf, Size_t *buf_size,
S_save_to_buffer(const char * string, const char **buf, Size_t *buf_size,
const Size_t offset)
{
/* Copy the NUL-terminated 'string' to 'buf' + 'offset'. 'buf' has size
Expand Down
2 changes: 1 addition & 1 deletion proto.h
Expand Up @@ -5121,7 +5121,7 @@ PERL_CALLCONV SV* Perl_hfree_next_entry(pTHX_ HV *hv, STRLEN *indexp);
#endif
#if defined(PERL_IN_LOCALE_C)
#ifndef PERL_NO_INLINE_FUNCTIONS
PERL_STATIC_INLINE const char * S_save_to_buffer(const char * string, char **buf, Size_t *buf_size, const Size_t offset)
PERL_STATIC_INLINE const char * S_save_to_buffer(const char * string, const char **buf, Size_t *buf_size, const Size_t offset)
__attribute__warn_unused_result__;
#define PERL_ARGS_ASSERT_SAVE_TO_BUFFER \
assert(buf_size)
Expand Down

0 comments on commit 6a6d2de

Please sign in to comment.