diff -ru3 ../glib.cvs/ChangeLog ./ChangeLog --- ../glib.cvs/ChangeLog Sun Nov 01 01:08:16 1998 +++ ./ChangeLog Sun Nov 01 02:05:42 1998 @@ -1,3 +1,18 @@ +1998-11-01 Tor Lillqvist * glib.h: removed old G_ENUM(), G_FLAGS(), G_NV() and G_SV() macros. diff -ru3 ../glib.cvs/glib.def ./glib.def --- ../glib.cvs/glib.def Tue Oct 27 05:44:44 1998 +++ ./glib.def Sun Nov 01 01:24:52 1998 @@ -204,6 +204,7 @@ 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 @@ g_strdup_printf g_strdup_vprintf g_strerror + g_strfreev g_string_append g_string_append_c g_string_assign @@ -265,11 +267,13 @@ 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 -ru3 ../glib.cvs/gutils.c ./gutils.c --- ../glib.cvs/gutils.c Tue Oct 27 08:07:14 1998 +++ ./gutils.c Sun Nov 01 02:06:04 1998 @@ -328,8 +328,10 @@ 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); @@ -342,23 +344,20 @@ * 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 } @@ -383,13 +382,23 @@ 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")); @@ -421,7 +430,6 @@ } else g_real_name = g_strdup (g_user_name); - g_home_dir = NULL; } # else /* !NATIVE_WIN32 */ g_user_name = g_strdup ("somebody"); @@ -430,9 +438,6 @@ # endif /* !NATIVE_WIN32 */ #endif /* !HAVE_PWD_H */ } - - if (!g_home_dir) - g_home_dir = g_strdup (g_tmp_dir); } gchar* @@ -453,6 +458,12 @@ 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) { @@ -462,6 +473,13 @@ 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) { @@ -517,7 +535,7 @@ GIOChannel* g_iochannel_new (gint fd) { - GIOChannel *channel = g_new0 (GIOChannel, 1); + GIOChannel *channel = g_new (GIOChannel, 1); channel->fd = fd; diff -ru3 ../glib.cvs/makefile.msc ./makefile.msc --- ../glib.cvs/makefile.msc Tue Oct 27 08:07:14 1998 +++ ./makefile.msc Sun Nov 01 01:30:22 1998 @@ -9,7 +9,7 @@ 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