From 6088718e19cce2b1ebb3f52965cbc1e8ed3a0eef Mon Sep 17 00:00:00 2001 From: Sebastian Wilhelmi Date: Thu, 28 Sep 2000 07:35:02 +0000 Subject: [PATCH] max_len can't be initialized statically as it might call a function. So do 2000-09-28 Sebastian Wilhelmi * gutils.c (g_get_current_dir): max_len can't be initialized statically as it might call a function. So do it at first call. --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-12 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ glib/gutils.c | 5 ++++- gutils.c | 5 ++++- 10 files changed, 48 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 26a0a290..b754cc47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-09-28 Sebastian Wilhelmi + + * gutils.c (g_get_current_dir): max_len can't be initialized + statically as it might call a function. So do it at first call. + Tue Sep 26 2000 Elliot Lee * glib.h: Add G_GNUC_PURE macro (but don't use it anywhere). diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 26a0a290..b754cc47 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +2000-09-28 Sebastian Wilhelmi + + * gutils.c (g_get_current_dir): max_len can't be initialized + statically as it might call a function. So do it at first call. + Tue Sep 26 2000 Elliot Lee * glib.h: Add G_GNUC_PURE macro (but don't use it anywhere). diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 26a0a290..b754cc47 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2000-09-28 Sebastian Wilhelmi + + * gutils.c (g_get_current_dir): max_len can't be initialized + statically as it might call a function. So do it at first call. + Tue Sep 26 2000 Elliot Lee * glib.h: Add G_GNUC_PURE macro (but don't use it anywhere). diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 26a0a290..b754cc47 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +2000-09-28 Sebastian Wilhelmi + + * gutils.c (g_get_current_dir): max_len can't be initialized + statically as it might call a function. So do it at first call. + Tue Sep 26 2000 Elliot Lee * glib.h: Add G_GNUC_PURE macro (but don't use it anywhere). diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 26a0a290..b754cc47 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +2000-09-28 Sebastian Wilhelmi + + * gutils.c (g_get_current_dir): max_len can't be initialized + statically as it might call a function. So do it at first call. + Tue Sep 26 2000 Elliot Lee * glib.h: Add G_GNUC_PURE macro (but don't use it anywhere). diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 26a0a290..b754cc47 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +2000-09-28 Sebastian Wilhelmi + + * gutils.c (g_get_current_dir): max_len can't be initialized + statically as it might call a function. So do it at first call. + Tue Sep 26 2000 Elliot Lee * glib.h: Add G_GNUC_PURE macro (but don't use it anywhere). diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 26a0a290..b754cc47 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +2000-09-28 Sebastian Wilhelmi + + * gutils.c (g_get_current_dir): max_len can't be initialized + statically as it might call a function. So do it at first call. + Tue Sep 26 2000 Elliot Lee * glib.h: Add G_GNUC_PURE macro (but don't use it anywhere). diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 26a0a290..b754cc47 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2000-09-28 Sebastian Wilhelmi + + * gutils.c (g_get_current_dir): max_len can't be initialized + statically as it might call a function. So do it at first call. + Tue Sep 26 2000 Elliot Lee * glib.h: Add G_GNUC_PURE macro (but don't use it anywhere). diff --git a/glib/gutils.c b/glib/gutils.c index 1f3c3a34..c7284ca2 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -425,7 +425,10 @@ g_get_current_dir (void) { gchar *buffer = NULL; gchar *dir = NULL; - static gulong max_len = (G_PATH_LENGTH == -1) ? 2048 : G_PATH_LENGTH; + static gulong max_len = 0; + + if (max_len == 0) + max_len = (G_PATH_LENGTH == -1) ? 2048 : G_PATH_LENGTH; /* We don't use getcwd(3) on SUNOS, because, it does a popen("pwd") * and, if that wasn't bad enough, hangs in doing so. diff --git a/gutils.c b/gutils.c index 1f3c3a34..c7284ca2 100644 --- a/gutils.c +++ b/gutils.c @@ -425,7 +425,10 @@ g_get_current_dir (void) { gchar *buffer = NULL; gchar *dir = NULL; - static gulong max_len = (G_PATH_LENGTH == -1) ? 2048 : G_PATH_LENGTH; + static gulong max_len = 0; + + if (max_len == 0) + max_len = (G_PATH_LENGTH == -1) ? 2048 : G_PATH_LENGTH; /* We don't use getcwd(3) on SUNOS, because, it does a popen("pwd") * and, if that wasn't bad enough, hangs in doing so. -- 2.34.1