for pointers. */
void *stack_bottom_variable;
- bool do_initial_setlocale;
bool no_loadup = false;
char *junk = 0;
char *dname_arg = 0;
set_binary_mode (STDOUT_FILENO, O_BINARY);
#endif /* MSDOS */
- /* Skip initial setlocale if LC_ALL is "C", as it's not needed in that case.
- The build procedure uses this while dumping, to ensure that the
- dumped Emacs does not have its system locale tables initialized,
- as that might cause screwups when the dumped Emacs starts up. */
- {
- char *lc_all = getenv ("LC_ALL");
- do_initial_setlocale = ! lc_all || strcmp (lc_all, "C");
- }
-
- /* Set locale now, so that initial error messages are localized properly.
- fixup_locale must wait until later, since it builds strings. */
- if (do_initial_setlocale)
- setlocale (LC_ALL, "");
+ /* Set locale, so that initial error messages are localized properly.
+ However, skip this if LC_ALL is "C", as it's not needed in that case.
+ Skipping helps if dumping with unexec, to ensure that the dumped
+ Emacs does not have its system locale tables initialized, as that
+ might cause screwups when the dumped Emacs starts up. */
+ char *lc_all = getenv ("LC_ALL");
+ if (! (lc_all && strcmp (lc_all, "C") == 0))
+ {
+ setlocale (LC_ALL, "");
+ fixup_locale ();
+ }
text_quoting_flag = using_utf8 ();
inhibit_window_system = 0;
init_alloc ();
init_bignum ();
init_threads ();
-
- if (do_initial_setlocale)
- {
- fixup_locale ();
- Vsystem_messages_locale = Vprevious_system_messages_locale;
- Vsystem_time_locale = Vprevious_system_time_locale;
- }
-
init_eval ();
init_atimer ();
running_asynch_code = 0;
if (! EQ (*plocale, desired_locale))
{
*plocale = desired_locale;
-#ifdef WINDOWSNT
+ char const *locale_string
+ = STRINGP (desired_locale) ? SSDATA (desired_locale) : "";
+# ifdef WINDOWSNT
/* Changing categories like LC_TIME usually requires specifying
an encoding suitable for the new locale, but MS-Windows's
'setlocale' will only switch the encoding when LC_ALL is
specified. So we ignore CATEGORY, use LC_ALL instead, and
then restore LC_NUMERIC to "C", so reading and printing
numbers is unaffected. */
- setlocale (LC_ALL, (STRINGP (desired_locale)
- ? SSDATA (desired_locale)
- : ""));
+ setlocale (LC_ALL, locale_string);
fixup_locale ();
-#else /* !WINDOWSNT */
- setlocale (category, (STRINGP (desired_locale)
- ? SSDATA (desired_locale)
- : ""));
-#endif /* !WINDOWSNT */
+# else /* !WINDOWSNT */
+ setlocale (category, locale_string);
+# endif /* !WINDOWSNT */
}
}
+static Lisp_Object Vprevious_system_time_locale;
+
/* Set system time locale to match Vsystem_time_locale, if possible. */
void
synchronize_system_time_locale (void)
Vsystem_time_locale);
}
+# ifdef LC_MESSAGES
+static Lisp_Object Vprevious_system_messages_locale;
+# endif
+
/* Set system messages locale to match Vsystem_messages_locale, if
possible. */
void
synchronize_system_messages_locale (void)
{
-#ifdef LC_MESSAGES
+# ifdef LC_MESSAGES
synchronize_locale (LC_MESSAGES, &Vprevious_system_messages_locale,
Vsystem_messages_locale);
-#endif
+# endif
}
#endif /* HAVE_SETLOCALE */
DEFVAR_LISP ("system-messages-locale", Vsystem_messages_locale,
doc: /* System locale for messages. */);
Vsystem_messages_locale = Qnil;
-
- DEFVAR_LISP ("previous-system-messages-locale",
- Vprevious_system_messages_locale,
- doc: /* Most recently used system locale for messages. */);
+#ifdef LC_MESSAGES
Vprevious_system_messages_locale = Qnil;
+ staticpro (&Vprevious_system_messages_locale);
+#endif
DEFVAR_LISP ("system-time-locale", Vsystem_time_locale,
doc: /* System locale for time. */);
Vsystem_time_locale = Qnil;
-
- DEFVAR_LISP ("previous-system-time-locale", Vprevious_system_time_locale,
- doc: /* Most recently used system locale for time. */);
Vprevious_system_time_locale = Qnil;
+ staticpro (&Vprevious_system_time_locale);
DEFVAR_LISP ("before-init-time", Vbefore_init_time,
doc: /* Value of `current-time' before Emacs begins initialization. */);