From 4f76917c6a239dfcecfd87682799953e27681be9 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sat, 11 Nov 2000 13:46:15 +0000 Subject: [PATCH] Improve chance to generate unique names with less effort a bit. 2000-11-11 Tor Lillqvist * gfileutils.c (g_mkstemp): Improve chance to generate unique names with less effort a bit. * gfileutils.h: Add g_file_open_tmp() declaration. * testglib.c: Include on Win32. * makefile.mingw.in: Correct the way to invoke sub-makes. 2000-11-11 Tor Lillqvist * gtypemodule.c: Include stdlib.h for exit(). * makefile.{mingw,msc}.in (gobject_OBJECTS): Add gtypemodule. * gobject.def: Add new functions. --- ChangeLog | 11 +++++++++++ ChangeLog.pre-2-0 | 11 +++++++++++ ChangeLog.pre-2-10 | 11 +++++++++++ ChangeLog.pre-2-12 | 11 +++++++++++ ChangeLog.pre-2-2 | 11 +++++++++++ ChangeLog.pre-2-4 | 11 +++++++++++ ChangeLog.pre-2-6 | 11 +++++++++++ ChangeLog.pre-2-8 | 11 +++++++++++ gfileutils.c | 3 ++- gfileutils.h | 7 ++++++- glib/gfileutils.c | 3 ++- glib/gfileutils.h | 7 ++++++- glib/makefile.mingw.in | 13 ++++++------- gobject/ChangeLog | 8 ++++++++ gobject/gobject.def | 11 +++++++++++ gobject/gtypemodule.c | 2 ++ gobject/makefile.mingw.in | 1 + gobject/makefile.msc.in | 1 + makefile.mingw.in | 13 ++++++------- testglib.c | 11 +++++++++++ tests/testglib.c | 11 +++++++++++ 21 files changed, 161 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9bbe5e2..8b8d153 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2000-11-11 Tor Lillqvist + + * gfileutils.c (g_mkstemp): Improve chance to generate unique + names with less effort a bit. + + * gfileutils.h: Add g_file_open_tmp() declaration. + + * testglib.c: Include on Win32. + + * makefile.mingw.in: Correct the way to invoke sub-makes. + Sun Nov 5 13:20:54 2000 Owen Taylor * glib-object.h: Add gtypemodule.h diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 9bbe5e2..8b8d153 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,14 @@ +2000-11-11 Tor Lillqvist + + * gfileutils.c (g_mkstemp): Improve chance to generate unique + names with less effort a bit. + + * gfileutils.h: Add g_file_open_tmp() declaration. + + * testglib.c: Include on Win32. + + * makefile.mingw.in: Correct the way to invoke sub-makes. + Sun Nov 5 13:20:54 2000 Owen Taylor * glib-object.h: Add gtypemodule.h diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 9bbe5e2..8b8d153 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,14 @@ +2000-11-11 Tor Lillqvist + + * gfileutils.c (g_mkstemp): Improve chance to generate unique + names with less effort a bit. + + * gfileutils.h: Add g_file_open_tmp() declaration. + + * testglib.c: Include on Win32. + + * makefile.mingw.in: Correct the way to invoke sub-makes. + Sun Nov 5 13:20:54 2000 Owen Taylor * glib-object.h: Add gtypemodule.h diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 9bbe5e2..8b8d153 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,14 @@ +2000-11-11 Tor Lillqvist + + * gfileutils.c (g_mkstemp): Improve chance to generate unique + names with less effort a bit. + + * gfileutils.h: Add g_file_open_tmp() declaration. + + * testglib.c: Include on Win32. + + * makefile.mingw.in: Correct the way to invoke sub-makes. + Sun Nov 5 13:20:54 2000 Owen Taylor * glib-object.h: Add gtypemodule.h diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 9bbe5e2..8b8d153 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,14 @@ +2000-11-11 Tor Lillqvist + + * gfileutils.c (g_mkstemp): Improve chance to generate unique + names with less effort a bit. + + * gfileutils.h: Add g_file_open_tmp() declaration. + + * testglib.c: Include on Win32. + + * makefile.mingw.in: Correct the way to invoke sub-makes. + Sun Nov 5 13:20:54 2000 Owen Taylor * glib-object.h: Add gtypemodule.h diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 9bbe5e2..8b8d153 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,14 @@ +2000-11-11 Tor Lillqvist + + * gfileutils.c (g_mkstemp): Improve chance to generate unique + names with less effort a bit. + + * gfileutils.h: Add g_file_open_tmp() declaration. + + * testglib.c: Include on Win32. + + * makefile.mingw.in: Correct the way to invoke sub-makes. + Sun Nov 5 13:20:54 2000 Owen Taylor * glib-object.h: Add gtypemodule.h diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 9bbe5e2..8b8d153 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,14 @@ +2000-11-11 Tor Lillqvist + + * gfileutils.c (g_mkstemp): Improve chance to generate unique + names with less effort a bit. + + * gfileutils.h: Add g_file_open_tmp() declaration. + + * testglib.c: Include on Win32. + + * makefile.mingw.in: Correct the way to invoke sub-makes. + Sun Nov 5 13:20:54 2000 Owen Taylor * glib-object.h: Add gtypemodule.h diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 9bbe5e2..8b8d153 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,14 @@ +2000-11-11 Tor Lillqvist + + * gfileutils.c (g_mkstemp): Improve chance to generate unique + names with less effort a bit. + + * gfileutils.h: Add g_file_open_tmp() declaration. + + * testglib.c: Include on Win32. + + * makefile.mingw.in: Correct the way to invoke sub-makes. + Sun Nov 5 13:20:54 2000 Owen Taylor * glib-object.h: Add gtypemodule.h diff --git a/gfileutils.c b/gfileutils.c index c8bb0a7..b897e1b 100644 --- a/gfileutils.c +++ b/gfileutils.c @@ -538,6 +538,7 @@ g_mkstemp (char *tmpl) static const int NLETTERS = sizeof (letters) - 1; glong value; GTimeVal tv; + static int counter = 0; len = strlen (tmpl); if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX")) @@ -548,7 +549,7 @@ g_mkstemp (char *tmpl) /* Get some more or less random data. */ g_get_current_time (&tv); - value = tv.tv_usec ^ tv.tv_sec; + value = (tv.tv_usec ^ tv.tv_sec) + counter++; for (count = 0; count < 100; value += 7777, ++count) { diff --git a/gfileutils.h b/gfileutils.h index dba134e..0e80543 100644 --- a/gfileutils.h +++ b/gfileutils.h @@ -81,7 +81,12 @@ gboolean g_file_get_contents (const gchar *filename, /* Wrapper / workalike for mkstemp() */ -int g_mkstemp (char *tmpl); +int g_mkstemp (char *tmpl); + +/* Wrapper for g_mkstemp */ +int g_file_open_tmp (const char *template, + char **name_used, + GError **error); G_END_DECLS diff --git a/glib/gfileutils.c b/glib/gfileutils.c index c8bb0a7..b897e1b 100644 --- a/glib/gfileutils.c +++ b/glib/gfileutils.c @@ -538,6 +538,7 @@ g_mkstemp (char *tmpl) static const int NLETTERS = sizeof (letters) - 1; glong value; GTimeVal tv; + static int counter = 0; len = strlen (tmpl); if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX")) @@ -548,7 +549,7 @@ g_mkstemp (char *tmpl) /* Get some more or less random data. */ g_get_current_time (&tv); - value = tv.tv_usec ^ tv.tv_sec; + value = (tv.tv_usec ^ tv.tv_sec) + counter++; for (count = 0; count < 100; value += 7777, ++count) { diff --git a/glib/gfileutils.h b/glib/gfileutils.h index dba134e..0e80543 100644 --- a/glib/gfileutils.h +++ b/glib/gfileutils.h @@ -81,7 +81,12 @@ gboolean g_file_get_contents (const gchar *filename, /* Wrapper / workalike for mkstemp() */ -int g_mkstemp (char *tmpl); +int g_mkstemp (char *tmpl); + +/* Wrapper for g_mkstemp */ +int g_file_open_tmp (const char *template, + char **name_used, + GError **error); G_END_DECLS diff --git a/glib/makefile.mingw.in b/glib/makefile.mingw.in index 5e7c948..2ae090a 100644 --- a/glib/makefile.mingw.in +++ b/glib/makefile.mingw.in @@ -24,10 +24,9 @@ DEPCFLAGS = $(LIBICONV_CFLAGS) DLLS_TO_BUILD = \ glib-$(GLIB_VER).dll \ - gmodule/gmodule-$(GLIB_VER).dll \ - gthread/gthread-$(GLIB_VER).dll \ - gobject/gobject-$(GLIB_VER).dll - + sub-gmodule \ + sub-gthread \ + sub-gobject all : \ config.h \ @@ -102,13 +101,13 @@ gspawn-win32-helper.exe : gspawn-win32.c ################ subdirectories -gmodule/gmodule-$(GLIB_VER).dll : glib-$(GLIB_VER).dll +sub-gmodule : cd gmodule && $(MAKE) -f makefile.mingw all -gthread/gthread-$(GLIB_VER).dll : glib-$(GLIB_VER).dll +sub-gthread : cd gthread && $(MAKE) -f makefile.mingw all -gobject/gobject-$(GLIB_VER).dll : glib-$(GLIB_VER).dll +sub-gobject : cd gobject && $(MAKE) -f makefile.mingw all ################ test progs diff --git a/gobject/ChangeLog b/gobject/ChangeLog index f8a0f79..6443eb9 100644 --- a/gobject/ChangeLog +++ b/gobject/ChangeLog @@ -1,3 +1,11 @@ +2000-11-11 Tor Lillqvist + + * gtypemodule.c: Include stdlib.h for exit(). + + * makefile.{mingw,msc}.in (gobject_OBJECTS): Add gtypemodule. + + * gobject.def: Add new functions. + Sun Nov 5 13:21:28 2000 Owen Taylor * Makefile.am gtypemodule.[ch]: New basic implementation of diff --git a/gobject/gobject.def b/gobject/gobject.def index c0bb1f3..ca84959 100644 --- a/gobject/gobject.def +++ b/gobject/gobject.def @@ -110,9 +110,20 @@ EXPORTS g_type_interface_peek g_type_interfaces g_type_is_a + g_type_module_add_interface + g_type_module_get_type + g_type_module_register_type + g_type_module_set_name + g_type_module_unuse + g_type_module_use g_type_name g_type_next_base g_type_parent + g_type_plugin_complete_interface_info + g_type_plugin_complete_type_info + g_type_plugin_get_type + g_type_plugin_unuse + g_type_plugin_use g_type_qname g_type_register_dynamic g_type_register_fundamental diff --git a/gobject/gtypemodule.c b/gobject/gtypemodule.c index 32f07f7..4e5848e 100644 --- a/gobject/gtypemodule.c +++ b/gobject/gtypemodule.c @@ -17,6 +17,8 @@ * Boston, MA 02111-1307, USA. */ +#include + #include "gtypeplugin.h" #include "gtypemodule.h" diff --git a/gobject/makefile.mingw.in b/gobject/makefile.mingw.in index eccd5b6..a0f0669 100644 --- a/gobject/makefile.mingw.in +++ b/gobject/makefile.mingw.in @@ -38,6 +38,7 @@ gobject_OBJECTS = \ gparamspecs.o \ gsignal.o \ gtype.o \ + gtypemodule.o \ gtypeplugin.o \ gvalue.o \ gvaluetypes.o diff --git a/gobject/makefile.msc.in b/gobject/makefile.msc.in index eb69589..db24b23 100644 --- a/gobject/makefile.msc.in +++ b/gobject/makefile.msc.in @@ -29,6 +29,7 @@ gobject_OBJECTS = \ gparamspecs.obj \ gsignal.obj \ gtype.obj \ + gtypemodule.obj \ gtypeplugin.obj \ gvalue.obj \ gvaluetypes.obj diff --git a/makefile.mingw.in b/makefile.mingw.in index 5e7c948..2ae090a 100644 --- a/makefile.mingw.in +++ b/makefile.mingw.in @@ -24,10 +24,9 @@ DEPCFLAGS = $(LIBICONV_CFLAGS) DLLS_TO_BUILD = \ glib-$(GLIB_VER).dll \ - gmodule/gmodule-$(GLIB_VER).dll \ - gthread/gthread-$(GLIB_VER).dll \ - gobject/gobject-$(GLIB_VER).dll - + sub-gmodule \ + sub-gthread \ + sub-gobject all : \ config.h \ @@ -102,13 +101,13 @@ gspawn-win32-helper.exe : gspawn-win32.c ################ subdirectories -gmodule/gmodule-$(GLIB_VER).dll : glib-$(GLIB_VER).dll +sub-gmodule : cd gmodule && $(MAKE) -f makefile.mingw all -gthread/gthread-$(GLIB_VER).dll : glib-$(GLIB_VER).dll +sub-gthread : cd gthread && $(MAKE) -f makefile.mingw all -gobject/gobject-$(GLIB_VER).dll : glib-$(GLIB_VER).dll +sub-gobject : cd gobject && $(MAKE) -f makefile.mingw all ################ test progs diff --git a/testglib.c b/testglib.c index 3eedc81..2f7b615 100644 --- a/testglib.c +++ b/testglib.c @@ -24,13 +24,24 @@ * GLib at ftp://ftp.gtk.org/pub/gtk/. */ +#include "config.h" + #undef G_LOG_DOMAIN #include #include #include + #include "glib.h" +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef G_OS_WIN32 +#include /* For read(), write() etc */ +#endif + int array[10000]; gboolean failed = FALSE; diff --git a/tests/testglib.c b/tests/testglib.c index 3eedc81..2f7b615 100644 --- a/tests/testglib.c +++ b/tests/testglib.c @@ -24,13 +24,24 @@ * GLib at ftp://ftp.gtk.org/pub/gtk/. */ +#include "config.h" + #undef G_LOG_DOMAIN #include #include #include + #include "glib.h" +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef G_OS_WIN32 +#include /* For read(), write() etc */ +#endif + int array[10000]; gboolean failed = FALSE; -- 2.7.4