glib/tools
Alexander Slobodeniuk e862f34dd8 gmessages: introduce g_log_writer_default_set_debug_domains()
The problem is that resetting the environment of a
proccess is not safe, this is mentioned in the man
pages of the setenv, and also by the concept:
when we get a constant string returned by the getenv,
we need to be guaranteed that this string will exist
during all that time we are using it. While setting
the same env var to another value destroys this string
inside of libc.

Now looking at the should_drop_message(), we can see
that it just gets the environment on every call. Getting
the environment is safe, but however there's no safe way
to switch the logging domains selection: setenv can't be
used because of the reasons listed above.

That is why g_log_writer_default_set_debug_domains() is
needed: it's just a safe replacement for the setenv in this case.

Now should_drop_message() still reads the environment, but
does so only on the first call, after that the domains are
stored internally, and can only be changed by
g_log_writer_default_set_debug_domains().

This also means that now resetting G_MESSAGES_DEBUG env
var in runtime has no effect. But in any case this is not
what the user should do, because resetting the environment
in runtime is not correct.
2023-11-21 20:49:37 +01:00
..
gen-visibility-macros.py tools: Reformat gen-visibility-macros.py with black 2022-10-14 18:15:25 +01:00
generate-uac-manifest.py tools: Add script to create UAC manifests for Windows 2023-06-30 11:32:44 +08:00
glib-gettextize.in tools: Add SPDX license header to glib-gettextize.in 2022-06-01 12:45:33 +01:00
glib.supp gmessages: introduce g_log_writer_default_set_debug_domains() 2023-11-21 20:49:37 +01:00
meson.build tools: Add script to create UAC manifests for Windows 2023-06-30 11:32:44 +08:00
update-unicode-data.sh tools/update-unicode-data.sh: Add a script to handle the unicode updates 2022-09-15 03:43:04 +02:00