Skip to content

Commit

Permalink
locale.c: Change initialization; Move decls close to use
Browse files Browse the repository at this point in the history
Initializing to a constant string doesn't play well with Safefree, as
Coverity noted in CID 356663.

While we're at it move the related declarations close to their initial
use.
  • Loading branch information
khwilliamson committed Sep 8, 2022
1 parent f9e2b18 commit 60d3cb4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions locale.c
Original file line number Diff line number Diff line change
Expand Up @@ -1624,9 +1624,6 @@ S_new_numeric(pTHX_ const char *newnum)
* such platforms.
*/

const char * radix = C_decimal_point;
utf8ness_t utf8ness = UTF8NESS_IMMATERIAL;

DEBUG_L( PerlIO_printf(Perl_debug_log,
"Called new_numeric with %s, PL_numeric_name=%s\n",
newnum, PL_numeric_name));
Expand Down Expand Up @@ -1662,6 +1659,9 @@ S_new_numeric(pTHX_ const char *newnum)

# endif

const char * radix = NULL;
utf8ness_t utf8ness = UTF8NESS_IMMATERIAL;

/* Find and save this locale's radix character. */
my_langinfo_c(RADIXCHAR, LC_NUMERIC, PL_numeric_name,
&radix, NULL, &utf8ness);
Expand Down

0 comments on commit 60d3cb4

Please sign in to comment.