mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-08 10:26:16 +01:00
Merge branch 'g-getenv-everywhere' into 'master'
glib: Use g_getenv everywhere instead of getenv See merge request GNOME/glib!1579
This commit is contained in:
commit
221e32d9ac
@ -49,6 +49,7 @@
|
|||||||
#include "gthreadprivate.h"
|
#include "gthreadprivate.h"
|
||||||
#include "gunicode.h"
|
#include "gunicode.h"
|
||||||
#include "gfileutils.h"
|
#include "gfileutils.h"
|
||||||
|
#include "genviron.h"
|
||||||
|
|
||||||
#include "glibintl.h"
|
#include "glibintl.h"
|
||||||
|
|
||||||
@ -1131,14 +1132,14 @@ g_get_filename_charsets (const gchar ***filename_charsets)
|
|||||||
if (!(cache->charset && strcmp (cache->charset, charset) == 0))
|
if (!(cache->charset && strcmp (cache->charset, charset) == 0))
|
||||||
{
|
{
|
||||||
const gchar *new_charset;
|
const gchar *new_charset;
|
||||||
gchar *p;
|
const gchar *p;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
g_free (cache->charset);
|
g_free (cache->charset);
|
||||||
g_strfreev (cache->filename_charsets);
|
g_strfreev (cache->filename_charsets);
|
||||||
cache->charset = g_strdup (charset);
|
cache->charset = g_strdup (charset);
|
||||||
|
|
||||||
p = getenv ("G_FILENAME_ENCODING");
|
p = g_getenv ("G_FILENAME_ENCODING");
|
||||||
if (p != NULL && p[0] != '\0')
|
if (p != NULL && p[0] != '\0')
|
||||||
{
|
{
|
||||||
cache->filename_charsets = g_strsplit (p, ",", 0);
|
cache->filename_charsets = g_strsplit (p, ",", 0);
|
||||||
@ -1154,7 +1155,7 @@ g_get_filename_charsets (const gchar ***filename_charsets)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (getenv ("G_BROKEN_FILENAMES") != NULL)
|
else if (g_getenv ("G_BROKEN_FILENAMES") != NULL)
|
||||||
{
|
{
|
||||||
cache->filename_charsets = g_new0 (gchar *, 2);
|
cache->filename_charsets = g_new0 (gchar *, 2);
|
||||||
cache->is_utf8 = g_get_charset (&new_charset);
|
cache->is_utf8 = g_get_charset (&new_charset);
|
||||||
|
@ -263,7 +263,7 @@ condition_to_string (GIOCondition condition)
|
|||||||
static gboolean
|
static gboolean
|
||||||
g_io_win32_get_debug_flag (void)
|
g_io_win32_get_debug_flag (void)
|
||||||
{
|
{
|
||||||
return (getenv ("G_IO_WIN32_DEBUG") != NULL);
|
return (g_getenv ("G_IO_WIN32_DEBUG") != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -663,7 +663,7 @@ g_main_context_new (void)
|
|||||||
if (g_once_init_enter (&initialised))
|
if (g_once_init_enter (&initialised))
|
||||||
{
|
{
|
||||||
#ifdef G_MAIN_POLL_DEBUG
|
#ifdef G_MAIN_POLL_DEBUG
|
||||||
if (getenv ("G_MAIN_POLL_DEBUG") != NULL)
|
if (g_getenv ("G_MAIN_POLL_DEBUG") != NULL)
|
||||||
_g_main_poll_debug = TRUE;
|
_g_main_poll_debug = TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ slice_config_init (SliceConfig *config)
|
|||||||
|
|
||||||
*config = slice_config;
|
*config = slice_config;
|
||||||
|
|
||||||
val = getenv ("G_SLICE");
|
val = g_getenv ("G_SLICE");
|
||||||
if (val != NULL)
|
if (val != NULL)
|
||||||
{
|
{
|
||||||
gint flags;
|
gint flags;
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
{ \
|
{ \
|
||||||
if (debug == -1) \
|
if (debug == -1) \
|
||||||
{ \
|
{ \
|
||||||
if (getenv ("G_SPAWN_WIN32_DEBUG") != NULL) \
|
if (g_getenv ("G_SPAWN_WIN32_DEBUG") != NULL) \
|
||||||
debug = 1; \
|
debug = 1; \
|
||||||
else \
|
else \
|
||||||
debug = 0; \
|
debug = 0; \
|
||||||
|
@ -447,7 +447,7 @@ zone_info_unix (const gchar *identifier,
|
|||||||
gchar *resolved_identifier = NULL;
|
gchar *resolved_identifier = NULL;
|
||||||
const gchar *tzdir;
|
const gchar *tzdir;
|
||||||
|
|
||||||
tzdir = getenv ("TZDIR");
|
tzdir = g_getenv ("TZDIR");
|
||||||
if (tzdir == NULL)
|
if (tzdir == NULL)
|
||||||
tzdir = "/usr/share/zoneinfo";
|
tzdir = "/usr/share/zoneinfo";
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ g_win32_getlocale (void)
|
|||||||
{
|
{
|
||||||
LCID lcid;
|
LCID lcid;
|
||||||
LANGID langid;
|
LANGID langid;
|
||||||
gchar *ev;
|
const gchar *ev;
|
||||||
gint primary, sub;
|
gint primary, sub;
|
||||||
char iso639[10];
|
char iso639[10];
|
||||||
char iso3166[10];
|
char iso3166[10];
|
||||||
@ -120,9 +120,9 @@ g_win32_getlocale (void)
|
|||||||
* since GTK+ 2.10.7 setting either LC_ALL or LANG also sets the
|
* since GTK+ 2.10.7 setting either LC_ALL or LANG also sets the
|
||||||
* Win32 locale and C library locale through code in gtkmain.c.
|
* Win32 locale and C library locale through code in gtkmain.c.
|
||||||
*/
|
*/
|
||||||
if (((ev = getenv ("LC_ALL")) != NULL && ev[0] != '\0')
|
if (((ev = g_getenv ("LC_ALL")) != NULL && ev[0] != '\0')
|
||||||
|| ((ev = getenv ("LC_MESSAGES")) != NULL && ev[0] != '\0')
|
|| ((ev = g_getenv ("LC_MESSAGES")) != NULL && ev[0] != '\0')
|
||||||
|| ((ev = getenv ("LANG")) != NULL && ev[0] != '\0'))
|
|| ((ev = g_getenv ("LANG")) != NULL && ev[0] != '\0'))
|
||||||
return g_strdup (ev);
|
return g_strdup (ev);
|
||||||
|
|
||||||
lcid = GetThreadLocale ();
|
lcid = GetThreadLocale ();
|
||||||
@ -1084,7 +1084,7 @@ g_win32_veh_handler (PEXCEPTION_POINTERS ExceptionInfo)
|
|||||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
catch_list = getenv ("G_VEH_CATCH");
|
catch_list = g_getenv ("G_VEH_CATCH");
|
||||||
|
|
||||||
while (!catch &&
|
while (!catch &&
|
||||||
catch_list != NULL &&
|
catch_list != NULL &&
|
||||||
@ -1143,7 +1143,7 @@ g_win32_veh_handler (PEXCEPTION_POINTERS ExceptionInfo)
|
|||||||
|
|
||||||
fflush (stderr);
|
fflush (stderr);
|
||||||
|
|
||||||
debugger_env = getenv ("G_DEBUGGER");
|
debugger_env = g_getenv ("G_DEBUGGER");
|
||||||
|
|
||||||
if (debugger_env == NULL)
|
if (debugger_env == NULL)
|
||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
@ -1173,7 +1173,7 @@ g_win32_veh_handler (PEXCEPTION_POINTERS ExceptionInfo)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
TRUE,
|
TRUE,
|
||||||
getenv ("G_DEBUGGER_OLD_CONSOLE") != NULL ? 0 : CREATE_NEW_CONSOLE,
|
g_getenv ("G_DEBUGGER_OLD_CONSOLE") != NULL ? 0 : CREATE_NEW_CONSOLE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&si,
|
&si,
|
||||||
@ -1213,7 +1213,7 @@ g_crash_handler_win32_init (void)
|
|||||||
* break advanced exception handling such as in CLRs like C# or other managed
|
* break advanced exception handling such as in CLRs like C# or other managed
|
||||||
* code. See: https://blogs.msdn.microsoft.com/jmstall/2006/05/24/beware-of-the-vectored-exception-handler-and-managed-code/
|
* code. See: https://blogs.msdn.microsoft.com/jmstall/2006/05/24/beware-of-the-vectored-exception-handler-and-managed-code/
|
||||||
*/
|
*/
|
||||||
if (getenv ("G_DEBUGGER") == NULL && getenv("G_VEH_CATCH") == NULL)
|
if (g_getenv ("G_DEBUGGER") == NULL && g_getenv("G_VEH_CATCH") == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WinVEH_handle = AddVectoredExceptionHandler (0, &g_win32_veh_handler);
|
WinVEH_handle = AddVectoredExceptionHandler (0, &g_win32_veh_handler);
|
||||||
|
Loading…
Reference in New Issue
Block a user