From 91ffe2aec880a68b7d28e1194314e563fdd690d7 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sun, 26 Mar 2023 11:54:56 -0600 Subject: [PATCH] locale.c: Flatten two nested if's These can be combined into a single more cohesive construct --- locale.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/locale.c b/locale.c index 591d41f7f898..a29d590bcffa 100644 --- a/locale.c +++ b/locale.c @@ -1330,13 +1330,11 @@ S_querylocale_2008_i(pTHX_ const unsigned int index) # ifdef USE_PL_CURLOCALES - /* We have up-to-date values when we keep our own records, - * except sometimes, LC_ALL */ - if (index == LC_ALL_INDEX_) { - if (PL_curlocales[LC_ALL_INDEX_] == NULL) { - PL_curlocales[LC_ALL_INDEX_] = + /* PL_curlocales[] is kept up-to-date for all categories except LC_ALL, + * which may be invalidated, and if so, should now be calculated. */ + if (index == LC_ALL_INDEX_ && PL_curlocales[LC_ALL_INDEX_] == NULL) { + PL_curlocales[LC_ALL_INDEX_] = savepv(calculate_LC_ALL_string((const char **) &PL_curlocales)); - } } retval = mortalized_pv_copy(PL_curlocales[index]);