This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.c: Reorder some statements in a switch()
authorKarl Williamson <khw@cpan.org>
Thu, 16 Nov 2023 14:57:17 +0000 (07:57 -0700)
committerKarl Williamson <khw@cpan.org>
Wed, 13 Dec 2023 01:44:36 +0000 (18:44 -0700)
This unifies the common text in two case: statements, and makes all of
them do their business in the same order.

This makes it easier to compare and contrast the actions of the various
case:s

locale.c

index 04d8670..5ddf702 100644 (file)
--- a/locale.c
+++ b/locale.c
@@ -5089,31 +5089,30 @@ S_my_localeconv(pTHX_ const int item)
 #    ifdef USE_LOCALE_NUMERIC
 
           case RADIXCHAR:
-            locale = numeric_locale = PL_numeric_name;
-            index_bits = OFFSET_TO_BIT(NUMERIC_OFFSET);
             strings[NUMERIC_OFFSET] = DECIMAL_POINT_ADDRESS;
-            integers = NULL;
-            break;
+            goto numeric_common;
 
           case THOUSEP:
-            index_bits = OFFSET_TO_BIT(NUMERIC_OFFSET);
-            locale = numeric_locale = PL_numeric_name;
             strings[NUMERIC_OFFSET] = thousands_sep_string;
+
+          numeric_common:
             integers = NULL;
+            index_bits = OFFSET_TO_BIT(NUMERIC_OFFSET);
+            locale = numeric_locale = PL_numeric_name;
             break;
 
 #    endif
 #    ifdef USE_LOCALE_MONETARY
 
           case CRNCYSTR:
-            index_bits = OFFSET_TO_BIT(MONETARY_OFFSET);
-            locale = monetary_locale = querylocale_c(LC_MONETARY);
-
             /* This item needs the values for both the currency symbol, and
              * another one used to construct the nl_langino()-compatible
              * return. */
             strings[MONETARY_OFFSET] = CURRENCY_SYMBOL_ADDRESS;
             integers = P_CS_PRECEDES_ADDRESS;
+
+            index_bits = OFFSET_TO_BIT(MONETARY_OFFSET);
+            locale = monetary_locale = querylocale_c(LC_MONETARY);
             break;
 
 #    endif