From bd00f6f524594923a6705e22de4eef81a52cd6c7 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 26 Dec 2020 15:16:59 -0700 Subject: [PATCH] locale.c: Move unreachable code It turns out this code, setting errno, is unreachable. Move it to the place where it would do some good, removing an extraneous, unreachable return; --- locale.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/locale.c b/locale.c index 018e4131a4e4..af61c1f4223d 100644 --- a/locale.c +++ b/locale.c @@ -342,6 +342,12 @@ S_get_category_index(const int category, const char * locale) "Unknown locale category %d%s%s", category, conditional_warn_text, locale); +# ifdef EINVAL + + SETERRNO(EINVAL, LIB_INVARG); + +# endif + /* Return an out-of-bounds value */ return NOMINAL_LC_ALL_INDEX + 1; } @@ -660,14 +666,6 @@ S_emulate_setlocale_i(pTHX_ const unsigned int index, const char * locale) return all_string; } -# ifdef EINVAL - - SETERRNO(EINVAL, LIB_INVARG); - -# endif - - return NULL; - # endif } /* End of this being setlocale(LC_foo, NULL) */