mirror of
https://github.com/i3/i3.git
synced 2026-02-04 19:45:32 +00:00
Before this commit, we used setlocale(LC_NUMERIC, "");, but that is not correct because it doesn’t nest: load_layout.c (sets LC_NUMERIC=C) calls con_mark(), which calls ipc_send_window_event() (sets LC_NUMERIC=C), which calls setlocale(LC_NUMERIC, ""); when returning, but now load_layout has LC_NUMERIC set per the environment, whereas the function expects to remain in LC_NUMERIC=C. Using newlocale and uselocale just swaps handles, which is a little cleaner than querying the locale with strdup(setlocale(LC_NUMERIC, NULL)); and restoring it later. The test only fails with certain locales, e.g. LC_NUMERIC=de_DE. I don’t think it’s important to set a locale in our test runner, (which locales are available is very system-dependent), as I am personally regularly testing with LC_NUMERIC=de_DE ;) fixes https://github.com/i3/i3/issues/6391