Skip to content

Commit

Permalink
locale.c: Cast return of setlocale() to const
Browse files Browse the repository at this point in the history
If they had it to do over again, the libc makers would have made the
return of this function 'const char *'.  We can cast it that way
internally to catch erroneous uses at compile time.
  • Loading branch information
khwilliamson committed May 6, 2021
1 parent 7ef5e25 commit 013af96
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion locale.c
Expand Up @@ -337,7 +337,8 @@ S_category_name(const int category)
#ifdef WIN32
# define porcelain_setlocale(cat, locale) win32_setlocale(cat, locale)
#else
# define porcelain_setlocale(cat, locale) setlocale(cat, locale)
# define porcelain_setlocale(cat, locale) \
((const char *) setlocale(cat, locale))
#endif

#ifndef USE_POSIX_2008_LOCALE
Expand Down

0 comments on commit 013af96

Please sign in to comment.