diff --git a/.cvsignore b/.cvsignore index 772b89cc7..e5db9f79a 100644 --- a/.cvsignore +++ b/.cvsignore @@ -16,3 +16,6 @@ testglib config.cache glib-config libglib.la +config.h.in +config.h +stamp-gc-h diff --git a/ChangeLog b/ChangeLog index f3bad008e..99483d096 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +Sat Oct 31 20:14:22 PST 1998 Manish Singh + + * applied glib-tml-981101-1 patch from Tor Lillqvist (ChangeLog + entry appended below) + + * testglib.c + * gstrfuncs.c + * glib.h: use G_HAVE_GINT64, since HAVE_GINT64 is gone + + * gmessages.c + * gscanner.c: #include in here too, for HAVE_UNISTD_H + +1998-11-01 Tor Lillqvist + + * glib.def: Added the new functions. + + * gutils.c: + (g_getenv): Better implementation on Win32. No loop necessary. + (g_get_any_init): Use P_tmpdir if defined as tmp directory. Don't + set home dir always to NULL on Win32. Don't use tmp directory as + last resort home directory, but return NULL if no home + directory is known (application must check). + + * makefile.msc: Better touch command, just COPYing a single file + sets the timestamp from that file, which isn't what touching should + do. + 1998-10-31 Raja R Harinath Land glib-rrh-19981025-0.patch. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index f3bad008e..99483d096 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,30 @@ +Sat Oct 31 20:14:22 PST 1998 Manish Singh + + * applied glib-tml-981101-1 patch from Tor Lillqvist (ChangeLog + entry appended below) + + * testglib.c + * gstrfuncs.c + * glib.h: use G_HAVE_GINT64, since HAVE_GINT64 is gone + + * gmessages.c + * gscanner.c: #include in here too, for HAVE_UNISTD_H + +1998-11-01 Tor Lillqvist + + * glib.def: Added the new functions. + + * gutils.c: + (g_getenv): Better implementation on Win32. No loop necessary. + (g_get_any_init): Use P_tmpdir if defined as tmp directory. Don't + set home dir always to NULL on Win32. Don't use tmp directory as + last resort home directory, but return NULL if no home + directory is known (application must check). + + * makefile.msc: Better touch command, just COPYing a single file + sets the timestamp from that file, which isn't what touching should + do. + 1998-10-31 Raja R Harinath Land glib-rrh-19981025-0.patch. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index f3bad008e..99483d096 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,30 @@ +Sat Oct 31 20:14:22 PST 1998 Manish Singh + + * applied glib-tml-981101-1 patch from Tor Lillqvist (ChangeLog + entry appended below) + + * testglib.c + * gstrfuncs.c + * glib.h: use G_HAVE_GINT64, since HAVE_GINT64 is gone + + * gmessages.c + * gscanner.c: #include in here too, for HAVE_UNISTD_H + +1998-11-01 Tor Lillqvist + + * glib.def: Added the new functions. + + * gutils.c: + (g_getenv): Better implementation on Win32. No loop necessary. + (g_get_any_init): Use P_tmpdir if defined as tmp directory. Don't + set home dir always to NULL on Win32. Don't use tmp directory as + last resort home directory, but return NULL if no home + directory is known (application must check). + + * makefile.msc: Better touch command, just COPYing a single file + sets the timestamp from that file, which isn't what touching should + do. + 1998-10-31 Raja R Harinath Land glib-rrh-19981025-0.patch. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index f3bad008e..99483d096 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,30 @@ +Sat Oct 31 20:14:22 PST 1998 Manish Singh + + * applied glib-tml-981101-1 patch from Tor Lillqvist (ChangeLog + entry appended below) + + * testglib.c + * gstrfuncs.c + * glib.h: use G_HAVE_GINT64, since HAVE_GINT64 is gone + + * gmessages.c + * gscanner.c: #include in here too, for HAVE_UNISTD_H + +1998-11-01 Tor Lillqvist + + * glib.def: Added the new functions. + + * gutils.c: + (g_getenv): Better implementation on Win32. No loop necessary. + (g_get_any_init): Use P_tmpdir if defined as tmp directory. Don't + set home dir always to NULL on Win32. Don't use tmp directory as + last resort home directory, but return NULL if no home + directory is known (application must check). + + * makefile.msc: Better touch command, just COPYing a single file + sets the timestamp from that file, which isn't what touching should + do. + 1998-10-31 Raja R Harinath Land glib-rrh-19981025-0.patch. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index f3bad008e..99483d096 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,30 @@ +Sat Oct 31 20:14:22 PST 1998 Manish Singh + + * applied glib-tml-981101-1 patch from Tor Lillqvist (ChangeLog + entry appended below) + + * testglib.c + * gstrfuncs.c + * glib.h: use G_HAVE_GINT64, since HAVE_GINT64 is gone + + * gmessages.c + * gscanner.c: #include in here too, for HAVE_UNISTD_H + +1998-11-01 Tor Lillqvist + + * glib.def: Added the new functions. + + * gutils.c: + (g_getenv): Better implementation on Win32. No loop necessary. + (g_get_any_init): Use P_tmpdir if defined as tmp directory. Don't + set home dir always to NULL on Win32. Don't use tmp directory as + last resort home directory, but return NULL if no home + directory is known (application must check). + + * makefile.msc: Better touch command, just COPYing a single file + sets the timestamp from that file, which isn't what touching should + do. + 1998-10-31 Raja R Harinath Land glib-rrh-19981025-0.patch. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index f3bad008e..99483d096 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,30 @@ +Sat Oct 31 20:14:22 PST 1998 Manish Singh + + * applied glib-tml-981101-1 patch from Tor Lillqvist (ChangeLog + entry appended below) + + * testglib.c + * gstrfuncs.c + * glib.h: use G_HAVE_GINT64, since HAVE_GINT64 is gone + + * gmessages.c + * gscanner.c: #include in here too, for HAVE_UNISTD_H + +1998-11-01 Tor Lillqvist + + * glib.def: Added the new functions. + + * gutils.c: + (g_getenv): Better implementation on Win32. No loop necessary. + (g_get_any_init): Use P_tmpdir if defined as tmp directory. Don't + set home dir always to NULL on Win32. Don't use tmp directory as + last resort home directory, but return NULL if no home + directory is known (application must check). + + * makefile.msc: Better touch command, just COPYing a single file + sets the timestamp from that file, which isn't what touching should + do. + 1998-10-31 Raja R Harinath Land glib-rrh-19981025-0.patch. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index f3bad008e..99483d096 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,30 @@ +Sat Oct 31 20:14:22 PST 1998 Manish Singh + + * applied glib-tml-981101-1 patch from Tor Lillqvist (ChangeLog + entry appended below) + + * testglib.c + * gstrfuncs.c + * glib.h: use G_HAVE_GINT64, since HAVE_GINT64 is gone + + * gmessages.c + * gscanner.c: #include in here too, for HAVE_UNISTD_H + +1998-11-01 Tor Lillqvist + + * glib.def: Added the new functions. + + * gutils.c: + (g_getenv): Better implementation on Win32. No loop necessary. + (g_get_any_init): Use P_tmpdir if defined as tmp directory. Don't + set home dir always to NULL on Win32. Don't use tmp directory as + last resort home directory, but return NULL if no home + directory is known (application must check). + + * makefile.msc: Better touch command, just COPYing a single file + sets the timestamp from that file, which isn't what touching should + do. + 1998-10-31 Raja R Harinath Land glib-rrh-19981025-0.patch. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index f3bad008e..99483d096 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,30 @@ +Sat Oct 31 20:14:22 PST 1998 Manish Singh + + * applied glib-tml-981101-1 patch from Tor Lillqvist (ChangeLog + entry appended below) + + * testglib.c + * gstrfuncs.c + * glib.h: use G_HAVE_GINT64, since HAVE_GINT64 is gone + + * gmessages.c + * gscanner.c: #include in here too, for HAVE_UNISTD_H + +1998-11-01 Tor Lillqvist + + * glib.def: Added the new functions. + + * gutils.c: + (g_getenv): Better implementation on Win32. No loop necessary. + (g_get_any_init): Use P_tmpdir if defined as tmp directory. Don't + set home dir always to NULL on Win32. Don't use tmp directory as + last resort home directory, but return NULL if no home + directory is known (application must check). + + * makefile.msc: Better touch command, just COPYing a single file + sets the timestamp from that file, which isn't what touching should + do. + 1998-10-31 Raja R Harinath Land glib-rrh-19981025-0.patch. diff --git a/glib.def b/glib.def index 0adf2e9a9..ba9f12c78 100644 --- a/glib.def +++ b/glib.def @@ -204,6 +204,7 @@ EXPORTS g_scanner_scope_remove_symbol g_scanner_set_scope g_scanner_stat_mode + g_scanner_sync_file_offset g_scanner_thaw_symbol_table g_scanner_unexp_token g_scanner_warn @@ -245,6 +246,7 @@ EXPORTS g_strdup_printf g_strdup_vprintf g_strerror + g_strfreev g_string_append g_string_append_c g_string_assign @@ -265,11 +267,13 @@ EXPORTS g_string_sprintfa g_string_truncate g_string_up + g_strjoinv g_strescape g_strndup g_strnfill g_strreverse g_strsignal + g_strsplit g_strtod g_strup g_timer_destroy diff --git a/glib.h b/glib.h index b7ee4f9d8..9041ef51a 100644 --- a/glib.h +++ b/glib.h @@ -587,7 +587,7 @@ typedef gint32 GTime; # define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val)) #endif /* __i386__ */ -#ifdef HAVE_GINT64 +#ifdef G_HAVE_GINT64 #define GUINT64_SWAP_LE_BE(val) ((guint64) ( \ (((guint64) (val) & (guint64) 0x00000000000000ffU) << 56) | \ (((guint64) (val) & (guint64) 0x000000000000ff00U) << 40) | \ @@ -625,7 +625,7 @@ typedef gint32 GTime; # define GUINT32_FROM_LE(val) ((guint32) (val)) # define GINT32_FROM_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val)) # define GUINT32_FROM_BE(val) (GUINT32_SWAP_LE_BE (val)) -# ifdef HAVE_GINT64 +# ifdef G_HAVE_GINT64 # define GINT64_TO_LE(val) ((gint64) (val)) # define GUINT64_TO_LE(val) ((guint64) (val)) # define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val)) @@ -652,7 +652,7 @@ typedef gint32 GTime; # define GUINT32_FROM_BE(val) ((guint32) (val)) # define GINT32_FROM_LE(val) ((gint32) GUINT32_SWAP_LE_BE (val)) # define GUINT32_FROM_LE(val) (GUINT32_SWAP_LE_BE (val)) -# ifdef HAVE_GINT64 +# ifdef G_HAVE_GINT64 # define GINT64_TO_BE(val) ((gint64) (val)) # define GUINT64_TO_BE(val) ((guint64) (val)) # define GINT64_TO_LE(val) ((gint64) GUINT64_SWAP_LE_BE (val)) diff --git a/glib/glib.def b/glib/glib.def index 0adf2e9a9..ba9f12c78 100644 --- a/glib/glib.def +++ b/glib/glib.def @@ -204,6 +204,7 @@ EXPORTS g_scanner_scope_remove_symbol g_scanner_set_scope g_scanner_stat_mode + g_scanner_sync_file_offset g_scanner_thaw_symbol_table g_scanner_unexp_token g_scanner_warn @@ -245,6 +246,7 @@ EXPORTS g_strdup_printf g_strdup_vprintf g_strerror + g_strfreev g_string_append g_string_append_c g_string_assign @@ -265,11 +267,13 @@ EXPORTS g_string_sprintfa g_string_truncate g_string_up + g_strjoinv g_strescape g_strndup g_strnfill g_strreverse g_strsignal + g_strsplit g_strtod g_strup g_timer_destroy diff --git a/glib/glib.h b/glib/glib.h index b7ee4f9d8..9041ef51a 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -587,7 +587,7 @@ typedef gint32 GTime; # define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val)) #endif /* __i386__ */ -#ifdef HAVE_GINT64 +#ifdef G_HAVE_GINT64 #define GUINT64_SWAP_LE_BE(val) ((guint64) ( \ (((guint64) (val) & (guint64) 0x00000000000000ffU) << 56) | \ (((guint64) (val) & (guint64) 0x000000000000ff00U) << 40) | \ @@ -625,7 +625,7 @@ typedef gint32 GTime; # define GUINT32_FROM_LE(val) ((guint32) (val)) # define GINT32_FROM_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val)) # define GUINT32_FROM_BE(val) (GUINT32_SWAP_LE_BE (val)) -# ifdef HAVE_GINT64 +# ifdef G_HAVE_GINT64 # define GINT64_TO_LE(val) ((gint64) (val)) # define GUINT64_TO_LE(val) ((guint64) (val)) # define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val)) @@ -652,7 +652,7 @@ typedef gint32 GTime; # define GUINT32_FROM_BE(val) ((guint32) (val)) # define GINT32_FROM_LE(val) ((gint32) GUINT32_SWAP_LE_BE (val)) # define GUINT32_FROM_LE(val) (GUINT32_SWAP_LE_BE (val)) -# ifdef HAVE_GINT64 +# ifdef G_HAVE_GINT64 # define GINT64_TO_BE(val) ((gint64) (val)) # define GUINT64_TO_BE(val) ((guint64) (val)) # define GINT64_TO_LE(val) ((gint64) GUINT64_SWAP_LE_BE (val)) diff --git a/glib/gmessages.c b/glib/gmessages.c index fa523111a..e0c6eacb1 100644 --- a/glib/gmessages.c +++ b/glib/gmessages.c @@ -16,6 +16,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/glib/gscanner.c b/glib/gscanner.c index 2bb0f471a..04b3ae5ee 100644 --- a/glib/gscanner.c +++ b/glib/gscanner.c @@ -21,6 +21,10 @@ */ #define __gscanner_c__ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c index 01816b359..c01877bd7 100644 --- a/glib/gstrfuncs.c +++ b/glib/gstrfuncs.c @@ -828,11 +828,11 @@ g_printf_string_upper_bound (const gchar* format, case 'u': case 'x': case 'X': -#ifdef HAVE_GINT64 +#ifdef G_HAVE_GINT64 if (extra_long) (void) va_arg (args, gint64); else -#endif /* HAVE_GINT64 */ +#endif /* G_HAVE_GINT64 */ { if (long_int) (void) va_arg (args, long); diff --git a/glib/gtimer.c b/glib/gtimer.c index a9ceed2d2..6e58fa0bd 100644 --- a/glib/gtimer.c +++ b/glib/gtimer.c @@ -16,6 +16,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include "glib.h" #ifdef HAVE_UNISTD_H #include diff --git a/glib/gutils.c b/glib/gutils.c index a4848211c..92b0b19ba 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -333,8 +333,10 @@ g_getenv (const gchar *variable) return getenv (variable); #else gchar *v; - guint l, k; - gchar *p; + guint k; + static gchar *p = NULL; + static gint l; + gchar dummy[2]; g_return_val_if_fail (variable != NULL, NULL); @@ -347,23 +349,20 @@ g_getenv (const gchar *variable) * calling ExpandEnvironmentStrings. */ - v = g_strdup (v); - l = 16; - do + /* First check how much space we need */ + k = ExpandEnvironmentStrings (v, dummy, 2); + /* Then allocate that much, and actualy do the expansion */ + if (p == NULL) { - p = g_new (gchar, l); - - k = ExpandEnvironmentStrings (v, p, l); - if (k > l) - { - g_free (p); - l *= 2; - } + p = g_malloc (k); + l = k; } - while (k > l); - - g_free (v); - + else if (k > l) + { + p = g_realloc (p, k); + l = k; + } + ExpandEnvironmentStrings (v, p, k); return p; #endif } @@ -388,13 +387,23 @@ g_get_any_init (void) if (!g_tmp_dir) g_tmp_dir = g_strdup (g_getenv ("TEMP")); +#ifdef P_tmpdir + if (!g_tmp_dir) + { + int k; + g_tmp_dir = g_strdup (P_tmpdir); + k = strlen (g_tmp_dir); + if (g_tmp_dir[k-1] == G_DIR_SEPARATOR) + g_tmp_dir[k-1] = '\0'; + } +#endif if (!g_tmp_dir) { #ifndef NATIVE_WIN32 - g_tmp_dir = g_strdup (G_DIR_SEPARATOR_S "tmp"); -#else /* !NATIVE_WIN32 */ - g_tmp_dir = g_strdup ("."); -#endif /* !NATIVE_WIN32 */ + g_tmp_dir = g_strdup ("/tmp"); +#else /* NATIVE_WIN32 */ + g_tmp_dir = g_strdup ("C:\\"); +#endif /* NATIVE_WIN32 */ } g_home_dir = g_strdup (g_getenv ("HOME")); @@ -426,7 +435,6 @@ g_get_any_init (void) } else g_real_name = g_strdup (g_user_name); - g_home_dir = NULL; } # else /* !NATIVE_WIN32 */ g_user_name = g_strdup ("somebody"); @@ -435,9 +443,6 @@ g_get_any_init (void) # endif /* !NATIVE_WIN32 */ #endif /* !HAVE_PWD_H */ } - - if (!g_home_dir) - g_home_dir = g_strdup (g_tmp_dir); } gchar* @@ -458,6 +463,12 @@ g_get_real_name (void) return g_real_name; } +/* Return the home directory of the user. If there is a HOME + * environment variable, its value is returned, otherwise use some + * system-dependent way of finding it out. If no home directory can be + * deduced, return NULL. + */ + gchar* g_get_home_dir (void) { @@ -467,6 +478,13 @@ g_get_home_dir (void) return g_home_dir; } +/* Return a directory to be used to store temporary files. This is the + * value of the TMPDIR, TMP or TEMP environment variables (they are + * checked in that order). If none of those exist, use P_tmpdir from + * stdio.h. If that isn't defined, return "/tmp" on POSIXly systems, + * and C:\ on Windows. + */ + gchar* g_get_tmp_dir (void) { @@ -522,7 +540,7 @@ g_int_hash (gconstpointer v) GIOChannel* g_iochannel_new (gint fd) { - GIOChannel *channel = g_new0 (GIOChannel, 1); + GIOChannel *channel = g_new (GIOChannel, 1); channel->fd = fd; diff --git a/glibconfig.h.in b/glibconfig.h.in deleted file mode 100644 index 1d3751588..000000000 --- a/glibconfig.h.in +++ /dev/null @@ -1,128 +0,0 @@ -/* glibconfig.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define if you don't have vprintf but do have _doprnt. */ -#undef HAVE_DOPRNT - -/* Define if you have . */ -#undef HAVE_UNISTD_H - -/* Define if you have the vprintf function. */ -#undef HAVE_VPRINTF - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if your processor stores words with the most significant - byte first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN - -#undef ENABLE_MEM_CHECK -#undef ENABLE_MEM_PROFILE - -#undef G_COMPILED_WITH_DEBUGGING -#undef HAVE_BROKEN_WCTYPE -#undef HAVE_DOPRNT -#undef HAVE_FLOAT_H -#undef HAVE_LIMITS_H -#undef HAVE_LONG_DOUBLE -#undef HAVE_PWD_H -#undef HAVE_SYS_PARAM_H -#undef HAVE_SYS_SELECT_H -#undef HAVE_SYS_TIME_H -#undef HAVE_SYS_TIMES_H -#undef HAVE_STRERROR -#undef HAVE_STRSIGNAL -#undef HAVE_UNISTD_H -#undef HAVE_VSNPRINTF -#undef HAVE_VALUES_H -#undef HAVE_VPRINTF -#undef HAVE_WCHAR_H -#undef HAVE_WCTYPE_H - -#undef NO_FD_SET -#undef NO_SYS_ERRLIST -#undef NO_SYS_SIGLIST - -#undef G_VA_COPY -#undef G_VA_COPY_AS_ARRAY -#undef G_HAVE___INLINE -#undef G_HAVE___INLINE__ -#undef G_HAVE_INLINE - -#undef GLIB_MAJOR_VERSION -#undef GLIB_MINOR_VERSION -#undef GLIB_MICRO_VERSION -#undef GLIB_INTERFACE_AGE -#undef GLIB_BINARY_AGE - -/* The number of bytes in a char. */ -#undef SIZEOF_CHAR - -/* The number of bytes in a int. */ -#undef SIZEOF_INT - -/* The number of bytes in a long. */ -#undef SIZEOF_LONG - -/* The number of bytes in a long long. */ -#undef SIZEOF_LONG_LONG - -/* The number of bytes in a short. */ -#undef SIZEOF_SHORT - -/* The number of bytes in a void *. */ -#undef SIZEOF_VOID_P - -/* Define if you have the atexit function. */ -#undef HAVE_ATEXIT - -/* Define if you have the lstat function. */ -#undef HAVE_LSTAT - -/* Define if you have the memmove function. */ -#undef HAVE_MEMMOVE - -/* Define if you have the on_exit function. */ -#undef HAVE_ON_EXIT - -/* Define if you have the strcasecmp function. */ -#undef HAVE_STRCASECMP - -/* Define if you have the strerror function. */ -#undef HAVE_STRERROR - -/* Define if you have the strsignal function. */ -#undef HAVE_STRSIGNAL - -/* Define if you have the vsnprintf function. */ -#undef HAVE_VSNPRINTF - -/* Define if you have the header file. */ -#undef HAVE_FLOAT_H - -/* Define if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define if you have the header file. */ -#undef HAVE_PWD_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_SELECT_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TIMES_H - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the header file. */ -#undef HAVE_VALUES_H diff --git a/gmessages.c b/gmessages.c index fa523111a..e0c6eacb1 100644 --- a/gmessages.c +++ b/gmessages.c @@ -16,6 +16,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/gscanner.c b/gscanner.c index 2bb0f471a..04b3ae5ee 100644 --- a/gscanner.c +++ b/gscanner.c @@ -21,6 +21,10 @@ */ #define __gscanner_c__ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include diff --git a/gstrfuncs.c b/gstrfuncs.c index 01816b359..c01877bd7 100644 --- a/gstrfuncs.c +++ b/gstrfuncs.c @@ -828,11 +828,11 @@ g_printf_string_upper_bound (const gchar* format, case 'u': case 'x': case 'X': -#ifdef HAVE_GINT64 +#ifdef G_HAVE_GINT64 if (extra_long) (void) va_arg (args, gint64); else -#endif /* HAVE_GINT64 */ +#endif /* G_HAVE_GINT64 */ { if (long_int) (void) va_arg (args, long); diff --git a/gtimer.c b/gtimer.c index a9ceed2d2..6e58fa0bd 100644 --- a/gtimer.c +++ b/gtimer.c @@ -16,6 +16,11 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + #include "glib.h" #ifdef HAVE_UNISTD_H #include diff --git a/gutils.c b/gutils.c index a4848211c..92b0b19ba 100644 --- a/gutils.c +++ b/gutils.c @@ -333,8 +333,10 @@ g_getenv (const gchar *variable) return getenv (variable); #else gchar *v; - guint l, k; - gchar *p; + guint k; + static gchar *p = NULL; + static gint l; + gchar dummy[2]; g_return_val_if_fail (variable != NULL, NULL); @@ -347,23 +349,20 @@ g_getenv (const gchar *variable) * calling ExpandEnvironmentStrings. */ - v = g_strdup (v); - l = 16; - do + /* First check how much space we need */ + k = ExpandEnvironmentStrings (v, dummy, 2); + /* Then allocate that much, and actualy do the expansion */ + if (p == NULL) { - p = g_new (gchar, l); - - k = ExpandEnvironmentStrings (v, p, l); - if (k > l) - { - g_free (p); - l *= 2; - } + p = g_malloc (k); + l = k; } - while (k > l); - - g_free (v); - + else if (k > l) + { + p = g_realloc (p, k); + l = k; + } + ExpandEnvironmentStrings (v, p, k); return p; #endif } @@ -388,13 +387,23 @@ g_get_any_init (void) if (!g_tmp_dir) g_tmp_dir = g_strdup (g_getenv ("TEMP")); +#ifdef P_tmpdir + if (!g_tmp_dir) + { + int k; + g_tmp_dir = g_strdup (P_tmpdir); + k = strlen (g_tmp_dir); + if (g_tmp_dir[k-1] == G_DIR_SEPARATOR) + g_tmp_dir[k-1] = '\0'; + } +#endif if (!g_tmp_dir) { #ifndef NATIVE_WIN32 - g_tmp_dir = g_strdup (G_DIR_SEPARATOR_S "tmp"); -#else /* !NATIVE_WIN32 */ - g_tmp_dir = g_strdup ("."); -#endif /* !NATIVE_WIN32 */ + g_tmp_dir = g_strdup ("/tmp"); +#else /* NATIVE_WIN32 */ + g_tmp_dir = g_strdup ("C:\\"); +#endif /* NATIVE_WIN32 */ } g_home_dir = g_strdup (g_getenv ("HOME")); @@ -426,7 +435,6 @@ g_get_any_init (void) } else g_real_name = g_strdup (g_user_name); - g_home_dir = NULL; } # else /* !NATIVE_WIN32 */ g_user_name = g_strdup ("somebody"); @@ -435,9 +443,6 @@ g_get_any_init (void) # endif /* !NATIVE_WIN32 */ #endif /* !HAVE_PWD_H */ } - - if (!g_home_dir) - g_home_dir = g_strdup (g_tmp_dir); } gchar* @@ -458,6 +463,12 @@ g_get_real_name (void) return g_real_name; } +/* Return the home directory of the user. If there is a HOME + * environment variable, its value is returned, otherwise use some + * system-dependent way of finding it out. If no home directory can be + * deduced, return NULL. + */ + gchar* g_get_home_dir (void) { @@ -467,6 +478,13 @@ g_get_home_dir (void) return g_home_dir; } +/* Return a directory to be used to store temporary files. This is the + * value of the TMPDIR, TMP or TEMP environment variables (they are + * checked in that order). If none of those exist, use P_tmpdir from + * stdio.h. If that isn't defined, return "/tmp" on POSIXly systems, + * and C:\ on Windows. + */ + gchar* g_get_tmp_dir (void) { @@ -522,7 +540,7 @@ g_int_hash (gconstpointer v) GIOChannel* g_iochannel_new (gint fd) { - GIOChannel *channel = g_new0 (GIOChannel, 1); + GIOChannel *channel = g_new (GIOChannel, 1); channel->fd = fd; diff --git a/makefile.msc b/makefile.msc index 4798fdde3..5f578a38c 100644 --- a/makefile.msc +++ b/makefile.msc @@ -9,7 +9,7 @@ CC = cl -G5 -GF -Ox -W3 -D_DLL -nologo LDFLAGS = /link /nodefaultlib:libc msvcrt.lib # /debug:full /debugtype:cv INSTALL = copy -TOUCH = copy makefile.msc +TOUCH = copy makefile.msc+nul GLIB_VER = 1.1 diff --git a/testglib.c b/testglib.c index ed32765de..3a20d62a6 100644 --- a/testglib.c +++ b/testglib.c @@ -323,7 +323,7 @@ main (int argc, guint n_dirname_checks = sizeof (dirname_checks) / sizeof (dirname_checks[0]); guint16 gu16t1 = 0x44afU, gu16t2 = 0xaf44U; guint32 gu32t1 = 0x02a7f109U, gu32t2 = 0x09f1a702U; -#ifdef HAVE_GINT64 +#ifdef G_HAVE_GINT64 guint64 gu64t1 = 0x1d636b02300a7aa7U, gu64t2 = 0xa77a0a30026b631dU; #endif @@ -345,10 +345,10 @@ main (int argc, TEST (NULL, sizeof (gint16) == 2); g_print ("\nchecking size of gint32: %d", (int)sizeof (gint32)); TEST (NULL, sizeof (gint32) == 4); -#ifdef HAVE_GINT64 +#ifdef G_HAVE_GINT64 g_print ("\nchecking size of gint64: %d", (int)sizeof (gint64)); TEST (NULL, sizeof (gint64) == 8); -#endif /* HAVE_GINT64 */ +#endif /* G_HAVE_GINT64 */ g_print ("\n"); g_print ("checking g_dirname()..."); @@ -824,7 +824,7 @@ main (int argc, #endif g_assert (GUINT16_SWAP_LE_BE (gu16t1) == gu16t2); g_assert (GUINT32_SWAP_LE_BE (gu32t1) == gu32t2); -#ifdef HAVE_GINT64 +#ifdef G_HAVE_GINT64 g_assert (GUINT64_SWAP_LE_BE (gu64t1) == gu64t2); #endif g_print ("ok\n"); diff --git a/tests/testglib.c b/tests/testglib.c index ed32765de..3a20d62a6 100644 --- a/tests/testglib.c +++ b/tests/testglib.c @@ -323,7 +323,7 @@ main (int argc, guint n_dirname_checks = sizeof (dirname_checks) / sizeof (dirname_checks[0]); guint16 gu16t1 = 0x44afU, gu16t2 = 0xaf44U; guint32 gu32t1 = 0x02a7f109U, gu32t2 = 0x09f1a702U; -#ifdef HAVE_GINT64 +#ifdef G_HAVE_GINT64 guint64 gu64t1 = 0x1d636b02300a7aa7U, gu64t2 = 0xa77a0a30026b631dU; #endif @@ -345,10 +345,10 @@ main (int argc, TEST (NULL, sizeof (gint16) == 2); g_print ("\nchecking size of gint32: %d", (int)sizeof (gint32)); TEST (NULL, sizeof (gint32) == 4); -#ifdef HAVE_GINT64 +#ifdef G_HAVE_GINT64 g_print ("\nchecking size of gint64: %d", (int)sizeof (gint64)); TEST (NULL, sizeof (gint64) == 8); -#endif /* HAVE_GINT64 */ +#endif /* G_HAVE_GINT64 */ g_print ("\n"); g_print ("checking g_dirname()..."); @@ -824,7 +824,7 @@ main (int argc, #endif g_assert (GUINT16_SWAP_LE_BE (gu16t1) == gu16t2); g_assert (GUINT32_SWAP_LE_BE (gu32t1) == gu32t2); -#ifdef HAVE_GINT64 +#ifdef G_HAVE_GINT64 g_assert (GUINT64_SWAP_LE_BE (gu64t1) == gu64t2); #endif g_print ("ok\n");