From b5b137c2df0526f670a69ad2e630946e9e107c797fe9e6034eec9edebaaebe5b Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Sat, 19 Apr 2025 02:39:13 -0400 Subject: [PATCH] Temporary local string "oldlocale". --- src/prefsparser.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/prefsparser.cc b/src/prefsparser.cc index 049d4b5..e489fff 100644 --- a/src/prefsparser.cc +++ b/src/prefsparser.cc @@ -146,7 +146,7 @@ static int parseOption(char *name, char *value, */ void PrefsParser::parse(FILE *fp) { - char *line, *name, *value, *oldLocale; + char *line, *name, *value; int st, line_number = 1; /* Symbol array, sorted alphabetically */ @@ -252,7 +252,7 @@ void PrefsParser::parse(FILE *fp) }; // changing the LC_NUMERIC locale (temporarily) to C // avoids parsing problems with float numbers - oldLocale = dStrdup(setlocale(LC_NUMERIC, NULL)); + std::string oldLocale = setlocale(LC_NUMERIC, NULL); setlocale(LC_NUMERIC, "C"); // scan the file line by line @@ -272,6 +272,5 @@ void PrefsParser::parse(FILE *fp) fclose(fp); // restore the old numeric locale - setlocale(LC_NUMERIC, oldLocale); - dFree(oldLocale); + setlocale(LC_NUMERIC, oldLocale.c_str()); }