When looking for symbols in the "main" module we must search both the main
[platform/upstream/glib.git] / gutils.c
index b858a7d..30c3bb7 100644 (file)
--- a/gutils.c
+++ b/gutils.c
@@ -32,8 +32,6 @@
 #include <config.h>
 #endif
 
-#include "glibconfig.h"
-
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #include <sys/param.h>
 #endif
 
-#ifdef G_OS_WIN32
-#  define STRICT                       /* Strict typing, please */
-#  include <windows.h>
-#  include <errno.h>
-#  include <ctype.h>
-#  ifdef _MSC_VER
-#    include <io.h>
-#  endif /* _MSC_VER */
-#endif /* G_OS_WIN32 */
-
 /* implement Glib's inline functions
  */
 #define        G_INLINE_FUNC extern
 #define G_PATH_LENGTH   2048
 #endif
 
+#ifdef G_OS_WIN32
+#  define STRICT                       /* Strict typing, please */
+#  include <windows.h>
+#  include <ctype.h>
+#  include <direct.h>
+#  include <io.h>
+#endif /* G_OS_WIN32 */
+
 const guint glib_major_version = GLIB_MAJOR_VERSION;
 const guint glib_minor_version = GLIB_MINOR_VERSION;
 const guint glib_micro_version = GLIB_MICRO_VERSION;
@@ -334,8 +330,8 @@ g_dirname (const gchar         *file_name)
 gchar*
 g_get_current_dir (void)
 {
-  gchar *buffer;
-  gchar *dir;
+  gchar *buffer = NULL;
+  gchar *dir = NULL;
   static gulong max_len = (G_PATH_LENGTH == -1) ? 2048 : G_PATH_LENGTH;
   
   /* We don't use getcwd(3) on SUNOS, because, it does a popen("pwd")
@@ -346,7 +342,7 @@ g_get_current_dir (void)
   *buffer = 0;
   dir = getwd (buffer);
 #else  /* !sun */
-  while (1)
+  while (max_len < G_MAXULONG / 2)
     {
       buffer = g_new (gchar, max_len + 1);
       *buffer = 0;
@@ -483,7 +479,7 @@ g_get_any_init (void)
              g_free (homepath);
            }
        }
-#endif /* !G_OS_WIN32 */
+#endif /* G_OS_WIN32 */
       
 #ifdef HAVE_PWD_H
       {