Skip to content

Commit

Permalink
locale.c: Add some asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
khwilliamson committed Apr 29, 2021
1 parent 105ca11 commit 8b75ddb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions locale.c
Expand Up @@ -702,6 +702,7 @@ S_my_querylocale_i(pTHX_ const unsigned int index)
DEBUG_Lv(PerlIO_printf(Perl_debug_log,
"my_querylocale_i(%s) returning '%s'\n",
category_names[index], retval));
assert(strNE(retval, ""));
return retval;
}

Expand Down Expand Up @@ -2645,6 +2646,7 @@ Perl_setlocale(const int category, const char * locale)

/* Here, an actual change is being requested. Do it */
retval = setlocale_i(cat_index, locale);
assert(retval == NULL || strNE(retval, ""));

if (! retval) {
DEBUG_L(PerlIO_printf(Perl_debug_log,
Expand All @@ -2671,6 +2673,7 @@ Perl_setlocale(const int category, const char * locale)

DEBUG_L(PerlIO_printf(Perl_debug_log, "returning '%s'\n", retval));

assert(strNE(retval, ""));
return retval;

#endif
Expand Down Expand Up @@ -3923,6 +3926,7 @@ S_my_langinfo_i(pTHX_

switch (item) {
default:
assert(item < 0); /* Make sure using perl_langinfo.h */
return "";

case RADIXCHAR:
Expand Down

0 comments on commit 8b75ddb

Please sign in to comment.