summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog90
-rw-r--r--ChangeLog.pre-2-090
-rw-r--r--ChangeLog.pre-2-1090
-rw-r--r--ChangeLog.pre-2-1290
-rw-r--r--ChangeLog.pre-2-290
-rw-r--r--ChangeLog.pre-2-490
-rw-r--r--ChangeLog.pre-2-690
-rw-r--r--ChangeLog.pre-2-890
-rw-r--r--garray.c106
-rw-r--r--ghash.c43
-rw-r--r--glib.h173
-rw-r--r--glib/garray.c106
-rw-r--r--glib/ghash.c43
-rw-r--r--glib/glib.h173
-rw-r--r--glib/gprimes.c23
-rw-r--r--gprimes.c23
-rw-r--r--testglib.c34
-rw-r--r--tests/testglib.c34
18 files changed, 876 insertions, 602 deletions
diff --git a/ChangeLog b/ChangeLog
index 4d42396ea..95fb3b9b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
+
+ * testglib.c (main): Update the array tests. Reduce the number of
+ iterations for the prepend test from 10000 to 100 since it is
+ O(n^2) and was taking longer than I would like to wait.
+
+ * garray.c: I've worked on the GArray interface, mostly. It was
+ seriously broken before and I hate to do it, but this is going to
+ break some code. It is important to do this now, because more and
+ more people are starting to use glib and the interface was both
+ broken and inconsistent. First, rename the _truncate functions of
+ both the GArray and GPtrArray classes to _set_size, since this
+ function can also be used to extend the arrays. GArray now
+ accepts two more initialization arguments: clear and element_size.
+ Instead of providing the type to each access function, the array
+ now stores the element size. Clear, if set, causes the library to
+ zero element's memory as the array expands. The major broken-ness
+ here was that array->len was in bytes, not elements. Now, since
+ the array knows its element size, array->len is correct and I have
+ removed the g_array_length macro. The only macro which now
+ accepts the type as an argument is g_array_index, which casts the
+ element to the right type--this interface does not change. The
+ append and prepend functions simply need the types removed.
+ g_ptr_array_remove_index now returns the removed element.
+
+ * gprimes.c (g_spaced_primes_closest): Move this function out of
+ ghash.c and rename it from g_hash_closest_prime. Fix the primes
+ so that they are actually prime (they weren't all -- isn't that
+ nice?).
+
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
@@ -26,8 +56,8 @@ Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
- * gmessages.c:
- (g_logv):
+ * gmessages.c:
+ (g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
@@ -109,7 +139,7 @@ Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
gint64 itself, packages that need gint64 should test for this
themselves.
- * glib.h:
+ * glib.h:
* gutils.c: added a new function g_vsnprintf().
Sun Aug 16 Elliot Lee
@@ -148,13 +178,13 @@ Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
in other required places.
* gnode.c:
- (g_node_prepend):
- (g_node_insert_before):
- (g_node_insert):
+ (g_node_prepend):
+ (g_node_insert_before):
+ (g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
- (g_node_insert_data):
+ (g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
@@ -211,7 +241,7 @@ Tue Aug 4 15:17:54 1998 Tim Janik <timj@gtk.org>
Mon Aug 3 16:02:26 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gnode.c: change order of gpointer data; field in struct _GNode to
be partly binary compatible with GList and GSList.
@@ -228,7 +258,7 @@ Fri Jul 31 09:08:16 1998 Tim Janik <timj@gtk.org>
* Makefile.am: compile gnode.c.
- * glib.h:
+ * glib.h:
* gnode.c: added implementation of n-way trees.
* gtree.c (g_tree_traverse): added a warning to the switch() statement
@@ -245,14 +275,14 @@ Mon Jul 27 01:02:27 1998 Tim Janik <timj@gtk.org>
implementation.
Sat Jul 25 16:09:00 1998 Mark Crichton <crichton@expert.cc.purdue.edu>
-
- * glib.h: gtime changed to g_time. gtime is used in
+
+ * glib.h: gtime changed to g_time. gtime is used in
/usr/include/time.h in NetBSD, causing multiple headaches.
If this isn't the right way of fixing it.... ;)
Thu Jul 23 00:29:14 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gscanner.c: new functions to make a scanner scope sensitive wrt
symbol lookups.
g_scanner_scope_foreach_symbol, g_scanner_scope_lookup_symbol,
@@ -273,7 +303,7 @@ Tue Jul 14 09:05:18 1998 Tim Janik <timj@gtk.org>
Fri Jul 10 06:33:43 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gutils.h: added a bunch of utility/wrapper functions:
g_basename(), g_getcwd(), g_get_user_name(), g_get_real_name(),
g_get_home_dir(), g_get_tmp_dir(), g_get_prgname() and g_set_prgname().
@@ -396,7 +426,7 @@ Thu Jun 11 04:15:31 1998 Tim Janik <timj@gtk.org>
Wed Jun 10 19:29:51 1998 Owen Taylor <otaylor@gtk.org>
* Makefile.am glib.m4 configure.in:
-
+
Moved out from GTK+; added AM_PATH_GLIB macro.
Wed Jun 10 12:56:07 1998 Owen Taylor <otaylor@gtk.org>
@@ -411,7 +441,7 @@ Sat May 23 19:00:01 1998 Owen Taylor <otaylor@gtk.org>
[ Combination of:
gtk-rrh-980412-0.patch (Raja R Harinath <harinath@cs.umn.edu>)
gtk-jbuhler-980516-0 (Jeremy Buhler <jbuhler@cs.washington.edu>) ]
-
+
* glib.h ghash.c gstring.c gdataset.c gutils.c:
- Added new typedef g_const_pointer; expunged all incorrect
uses of 'const gpointer'.
@@ -433,7 +463,7 @@ Sat Jun 6 14:09:22 PDT 1998 Manish Singh <yosh@gimp.org>
Wed Jun 3 06:19:42 1998 Tim Janik <timj@gtk.org>
- * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
+ * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
like g_chunk_new() with additional 0 initialization.
Mon Jun 1 04:43:27 1998 Tim Janik <timj@gtk.org>
@@ -451,7 +481,7 @@ Tue May 26 18:30:06 1998 Tim Janik <timj@gtk.org>
Mon May 18 22:14:39 1998 Owen Taylor <otaylor@gtk.org>
(Yasuhiro SHIRASAKI <joke@awa.tohoku.ac.jp> : gtk-joke-980517-0.patch)
-
+
* gutils.c: Restored a missing prototype for g_vsprintf.
Wed May 20 05:02:26 1998 Tim Janik <timj@gtk.org>
@@ -506,15 +536,15 @@ Tue May 12 19:22:58 1998 Owen Taylor <otaylor@gtk.org>
* glib/glib.h: Added macros G[U]INT_TO_POINTER() and
GPOINTER_TO_[U]INT for storing small integers integers
- inside pointers.
-
+ inside pointers.
+
* glib/testglib.c: Print sizeof() results
as g_print("%ld", (glong)sizeof(foo)), to deal with
size_t being long on Alpha's.
Tue May 12 16:54:15 1998 Owen Taylor <otaylor@gtk.org>
(James A <jamesa@demon.net> : gtk-jamesa-980511-4.patch)
-
+
* glib.h gstring.c gmessages.c: Added some missing
const to arguments.
@@ -611,8 +641,8 @@ Fri May 1 16:36:08 1998 Owen Taylor <otaylor@gtk.org>
Thu Apr 30 21:41:30 1998 Owen Taylor <otaylor@gtk.org>
- * gstring.c : Check arguments more carefully,
- (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
+ * gstring.c : Check arguments more carefully,
+ (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
Tue Apr 7 19:36:48 1998 Owen Taylor <owt1@cornell.edu>
@@ -638,7 +668,7 @@ Fri Apr 3 18:05:45 1998 Owen Taylor <owt1@cornell.edu>
* testglib.c: Removed literal german from strings
to appease SGI compiler.
-
+
Thu Mar 26 20:47:21 1998 Owen Taylor <owt1@cornell.edu>
* configure.in glib glibconfig.h.in: Add test for atexit/on_exit -
@@ -689,7 +719,7 @@ Mon Mar 2 17:51:18 1998 Owen Taylor <owt1@cornell.edu>
to take gchar* not guchar*
* testglib.c: Remove trailing ; after functions
-
+
Sun Mar 1 19:04:40 1998 Owen Taylor <owt1@cornell.edu>
* glib.h gstring.c: Added g_string_insert[_c]()
@@ -761,7 +791,7 @@ Sat Jan 17 23:52:40 1998 Owen Taylor <owt1@cornell.edu>
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
And const corrected. Old functions left in for now.
-
+
Fri Jan 9 20:03:46 1998 Tim Janik <timj@psynet.net>
* gutils.c (g_strerror): changed message for EAGAIN from
@@ -789,8 +819,8 @@ Sat Jan 3 20:23:25 1998 Owen Taylor <owt1@cornell.edu>
Fri Jan 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack.
@@ -822,8 +852,8 @@ Mon Dec 15 19:33:58 1997 Tim Janik <timj@psynet.net>
Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: this file now gets concatenated by makeglib_h from
glib_pre1.h and glib_pre2.h to merge in glibconfig.h wich got
created by configure (done by Jay Painter).
@@ -831,7 +861,7 @@ Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
* glib_pre2.h: the g_assert*() and g_return_*_fail() macros
are wrapped by G_STMT_START and G_STMT_END now, to avoid conflicts
when used within if (...) g_macro(); else ... conditionals.
-
+
Tue Dec 17 13:14:07 1996 Peter Mattis <pmattis@charnley.HIP.Berkeley.EDU>
* glib.h: Changed 'g_return_if_fail' and 'g_return_val_if_fail' to
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 4d42396ea..95fb3b9b8 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,33 @@
+Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
+
+ * testglib.c (main): Update the array tests. Reduce the number of
+ iterations for the prepend test from 10000 to 100 since it is
+ O(n^2) and was taking longer than I would like to wait.
+
+ * garray.c: I've worked on the GArray interface, mostly. It was
+ seriously broken before and I hate to do it, but this is going to
+ break some code. It is important to do this now, because more and
+ more people are starting to use glib and the interface was both
+ broken and inconsistent. First, rename the _truncate functions of
+ both the GArray and GPtrArray classes to _set_size, since this
+ function can also be used to extend the arrays. GArray now
+ accepts two more initialization arguments: clear and element_size.
+ Instead of providing the type to each access function, the array
+ now stores the element size. Clear, if set, causes the library to
+ zero element's memory as the array expands. The major broken-ness
+ here was that array->len was in bytes, not elements. Now, since
+ the array knows its element size, array->len is correct and I have
+ removed the g_array_length macro. The only macro which now
+ accepts the type as an argument is g_array_index, which casts the
+ element to the right type--this interface does not change. The
+ append and prepend functions simply need the types removed.
+ g_ptr_array_remove_index now returns the removed element.
+
+ * gprimes.c (g_spaced_primes_closest): Move this function out of
+ ghash.c and rename it from g_hash_closest_prime. Fix the primes
+ so that they are actually prime (they weren't all -- isn't that
+ nice?).
+
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
@@ -26,8 +56,8 @@ Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
- * gmessages.c:
- (g_logv):
+ * gmessages.c:
+ (g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
@@ -109,7 +139,7 @@ Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
gint64 itself, packages that need gint64 should test for this
themselves.
- * glib.h:
+ * glib.h:
* gutils.c: added a new function g_vsnprintf().
Sun Aug 16 Elliot Lee
@@ -148,13 +178,13 @@ Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
in other required places.
* gnode.c:
- (g_node_prepend):
- (g_node_insert_before):
- (g_node_insert):
+ (g_node_prepend):
+ (g_node_insert_before):
+ (g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
- (g_node_insert_data):
+ (g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
@@ -211,7 +241,7 @@ Tue Aug 4 15:17:54 1998 Tim Janik <timj@gtk.org>
Mon Aug 3 16:02:26 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gnode.c: change order of gpointer data; field in struct _GNode to
be partly binary compatible with GList and GSList.
@@ -228,7 +258,7 @@ Fri Jul 31 09:08:16 1998 Tim Janik <timj@gtk.org>
* Makefile.am: compile gnode.c.
- * glib.h:
+ * glib.h:
* gnode.c: added implementation of n-way trees.
* gtree.c (g_tree_traverse): added a warning to the switch() statement
@@ -245,14 +275,14 @@ Mon Jul 27 01:02:27 1998 Tim Janik <timj@gtk.org>
implementation.
Sat Jul 25 16:09:00 1998 Mark Crichton <crichton@expert.cc.purdue.edu>
-
- * glib.h: gtime changed to g_time. gtime is used in
+
+ * glib.h: gtime changed to g_time. gtime is used in
/usr/include/time.h in NetBSD, causing multiple headaches.
If this isn't the right way of fixing it.... ;)
Thu Jul 23 00:29:14 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gscanner.c: new functions to make a scanner scope sensitive wrt
symbol lookups.
g_scanner_scope_foreach_symbol, g_scanner_scope_lookup_symbol,
@@ -273,7 +303,7 @@ Tue Jul 14 09:05:18 1998 Tim Janik <timj@gtk.org>
Fri Jul 10 06:33:43 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gutils.h: added a bunch of utility/wrapper functions:
g_basename(), g_getcwd(), g_get_user_name(), g_get_real_name(),
g_get_home_dir(), g_get_tmp_dir(), g_get_prgname() and g_set_prgname().
@@ -396,7 +426,7 @@ Thu Jun 11 04:15:31 1998 Tim Janik <timj@gtk.org>
Wed Jun 10 19:29:51 1998 Owen Taylor <otaylor@gtk.org>
* Makefile.am glib.m4 configure.in:
-
+
Moved out from GTK+; added AM_PATH_GLIB macro.
Wed Jun 10 12:56:07 1998 Owen Taylor <otaylor@gtk.org>
@@ -411,7 +441,7 @@ Sat May 23 19:00:01 1998 Owen Taylor <otaylor@gtk.org>
[ Combination of:
gtk-rrh-980412-0.patch (Raja R Harinath <harinath@cs.umn.edu>)
gtk-jbuhler-980516-0 (Jeremy Buhler <jbuhler@cs.washington.edu>) ]
-
+
* glib.h ghash.c gstring.c gdataset.c gutils.c:
- Added new typedef g_const_pointer; expunged all incorrect
uses of 'const gpointer'.
@@ -433,7 +463,7 @@ Sat Jun 6 14:09:22 PDT 1998 Manish Singh <yosh@gimp.org>
Wed Jun 3 06:19:42 1998 Tim Janik <timj@gtk.org>
- * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
+ * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
like g_chunk_new() with additional 0 initialization.
Mon Jun 1 04:43:27 1998 Tim Janik <timj@gtk.org>
@@ -451,7 +481,7 @@ Tue May 26 18:30:06 1998 Tim Janik <timj@gtk.org>
Mon May 18 22:14:39 1998 Owen Taylor <otaylor@gtk.org>
(Yasuhiro SHIRASAKI <joke@awa.tohoku.ac.jp> : gtk-joke-980517-0.patch)
-
+
* gutils.c: Restored a missing prototype for g_vsprintf.
Wed May 20 05:02:26 1998 Tim Janik <timj@gtk.org>
@@ -506,15 +536,15 @@ Tue May 12 19:22:58 1998 Owen Taylor <otaylor@gtk.org>
* glib/glib.h: Added macros G[U]INT_TO_POINTER() and
GPOINTER_TO_[U]INT for storing small integers integers
- inside pointers.
-
+ inside pointers.
+
* glib/testglib.c: Print sizeof() results
as g_print("%ld", (glong)sizeof(foo)), to deal with
size_t being long on Alpha's.
Tue May 12 16:54:15 1998 Owen Taylor <otaylor@gtk.org>
(James A <jamesa@demon.net> : gtk-jamesa-980511-4.patch)
-
+
* glib.h gstring.c gmessages.c: Added some missing
const to arguments.
@@ -611,8 +641,8 @@ Fri May 1 16:36:08 1998 Owen Taylor <otaylor@gtk.org>
Thu Apr 30 21:41:30 1998 Owen Taylor <otaylor@gtk.org>
- * gstring.c : Check arguments more carefully,
- (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
+ * gstring.c : Check arguments more carefully,
+ (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
Tue Apr 7 19:36:48 1998 Owen Taylor <owt1@cornell.edu>
@@ -638,7 +668,7 @@ Fri Apr 3 18:05:45 1998 Owen Taylor <owt1@cornell.edu>
* testglib.c: Removed literal german from strings
to appease SGI compiler.
-
+
Thu Mar 26 20:47:21 1998 Owen Taylor <owt1@cornell.edu>
* configure.in glib glibconfig.h.in: Add test for atexit/on_exit -
@@ -689,7 +719,7 @@ Mon Mar 2 17:51:18 1998 Owen Taylor <owt1@cornell.edu>
to take gchar* not guchar*
* testglib.c: Remove trailing ; after functions
-
+
Sun Mar 1 19:04:40 1998 Owen Taylor <owt1@cornell.edu>
* glib.h gstring.c: Added g_string_insert[_c]()
@@ -761,7 +791,7 @@ Sat Jan 17 23:52:40 1998 Owen Taylor <owt1@cornell.edu>
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
And const corrected. Old functions left in for now.
-
+
Fri Jan 9 20:03:46 1998 Tim Janik <timj@psynet.net>
* gutils.c (g_strerror): changed message for EAGAIN from
@@ -789,8 +819,8 @@ Sat Jan 3 20:23:25 1998 Owen Taylor <owt1@cornell.edu>
Fri Jan 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack.
@@ -822,8 +852,8 @@ Mon Dec 15 19:33:58 1997 Tim Janik <timj@psynet.net>
Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: this file now gets concatenated by makeglib_h from
glib_pre1.h and glib_pre2.h to merge in glibconfig.h wich got
created by configure (done by Jay Painter).
@@ -831,7 +861,7 @@ Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
* glib_pre2.h: the g_assert*() and g_return_*_fail() macros
are wrapped by G_STMT_START and G_STMT_END now, to avoid conflicts
when used within if (...) g_macro(); else ... conditionals.
-
+
Tue Dec 17 13:14:07 1996 Peter Mattis <pmattis@charnley.HIP.Berkeley.EDU>
* glib.h: Changed 'g_return_if_fail' and 'g_return_val_if_fail' to
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 4d42396ea..95fb3b9b8 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,33 @@
+Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
+
+ * testglib.c (main): Update the array tests. Reduce the number of
+ iterations for the prepend test from 10000 to 100 since it is
+ O(n^2) and was taking longer than I would like to wait.
+
+ * garray.c: I've worked on the GArray interface, mostly. It was
+ seriously broken before and I hate to do it, but this is going to
+ break some code. It is important to do this now, because more and
+ more people are starting to use glib and the interface was both
+ broken and inconsistent. First, rename the _truncate functions of
+ both the GArray and GPtrArray classes to _set_size, since this
+ function can also be used to extend the arrays. GArray now
+ accepts two more initialization arguments: clear and element_size.
+ Instead of providing the type to each access function, the array
+ now stores the element size. Clear, if set, causes the library to
+ zero element's memory as the array expands. The major broken-ness
+ here was that array->len was in bytes, not elements. Now, since
+ the array knows its element size, array->len is correct and I have
+ removed the g_array_length macro. The only macro which now
+ accepts the type as an argument is g_array_index, which casts the
+ element to the right type--this interface does not change. The
+ append and prepend functions simply need the types removed.
+ g_ptr_array_remove_index now returns the removed element.
+
+ * gprimes.c (g_spaced_primes_closest): Move this function out of
+ ghash.c and rename it from g_hash_closest_prime. Fix the primes
+ so that they are actually prime (they weren't all -- isn't that
+ nice?).
+
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
@@ -26,8 +56,8 @@ Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
- * gmessages.c:
- (g_logv):
+ * gmessages.c:
+ (g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
@@ -109,7 +139,7 @@ Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
gint64 itself, packages that need gint64 should test for this
themselves.
- * glib.h:
+ * glib.h:
* gutils.c: added a new function g_vsnprintf().
Sun Aug 16 Elliot Lee
@@ -148,13 +178,13 @@ Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
in other required places.
* gnode.c:
- (g_node_prepend):
- (g_node_insert_before):
- (g_node_insert):
+ (g_node_prepend):
+ (g_node_insert_before):
+ (g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
- (g_node_insert_data):
+ (g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
@@ -211,7 +241,7 @@ Tue Aug 4 15:17:54 1998 Tim Janik <timj@gtk.org>
Mon Aug 3 16:02:26 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gnode.c: change order of gpointer data; field in struct _GNode to
be partly binary compatible with GList and GSList.
@@ -228,7 +258,7 @@ Fri Jul 31 09:08:16 1998 Tim Janik <timj@gtk.org>
* Makefile.am: compile gnode.c.
- * glib.h:
+ * glib.h:
* gnode.c: added implementation of n-way trees.
* gtree.c (g_tree_traverse): added a warning to the switch() statement
@@ -245,14 +275,14 @@ Mon Jul 27 01:02:27 1998 Tim Janik <timj@gtk.org>
implementation.
Sat Jul 25 16:09:00 1998 Mark Crichton <crichton@expert.cc.purdue.edu>
-
- * glib.h: gtime changed to g_time. gtime is used in
+
+ * glib.h: gtime changed to g_time. gtime is used in
/usr/include/time.h in NetBSD, causing multiple headaches.
If this isn't the right way of fixing it.... ;)
Thu Jul 23 00:29:14 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gscanner.c: new functions to make a scanner scope sensitive wrt
symbol lookups.
g_scanner_scope_foreach_symbol, g_scanner_scope_lookup_symbol,
@@ -273,7 +303,7 @@ Tue Jul 14 09:05:18 1998 Tim Janik <timj@gtk.org>
Fri Jul 10 06:33:43 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gutils.h: added a bunch of utility/wrapper functions:
g_basename(), g_getcwd(), g_get_user_name(), g_get_real_name(),
g_get_home_dir(), g_get_tmp_dir(), g_get_prgname() and g_set_prgname().
@@ -396,7 +426,7 @@ Thu Jun 11 04:15:31 1998 Tim Janik <timj@gtk.org>
Wed Jun 10 19:29:51 1998 Owen Taylor <otaylor@gtk.org>
* Makefile.am glib.m4 configure.in:
-
+
Moved out from GTK+; added AM_PATH_GLIB macro.
Wed Jun 10 12:56:07 1998 Owen Taylor <otaylor@gtk.org>
@@ -411,7 +441,7 @@ Sat May 23 19:00:01 1998 Owen Taylor <otaylor@gtk.org>
[ Combination of:
gtk-rrh-980412-0.patch (Raja R Harinath <harinath@cs.umn.edu>)
gtk-jbuhler-980516-0 (Jeremy Buhler <jbuhler@cs.washington.edu>) ]
-
+
* glib.h ghash.c gstring.c gdataset.c gutils.c:
- Added new typedef g_const_pointer; expunged all incorrect
uses of 'const gpointer'.
@@ -433,7 +463,7 @@ Sat Jun 6 14:09:22 PDT 1998 Manish Singh <yosh@gimp.org>
Wed Jun 3 06:19:42 1998 Tim Janik <timj@gtk.org>
- * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
+ * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
like g_chunk_new() with additional 0 initialization.
Mon Jun 1 04:43:27 1998 Tim Janik <timj@gtk.org>
@@ -451,7 +481,7 @@ Tue May 26 18:30:06 1998 Tim Janik <timj@gtk.org>
Mon May 18 22:14:39 1998 Owen Taylor <otaylor@gtk.org>
(Yasuhiro SHIRASAKI <joke@awa.tohoku.ac.jp> : gtk-joke-980517-0.patch)
-
+
* gutils.c: Restored a missing prototype for g_vsprintf.
Wed May 20 05:02:26 1998 Tim Janik <timj@gtk.org>
@@ -506,15 +536,15 @@ Tue May 12 19:22:58 1998 Owen Taylor <otaylor@gtk.org>
* glib/glib.h: Added macros G[U]INT_TO_POINTER() and
GPOINTER_TO_[U]INT for storing small integers integers
- inside pointers.
-
+ inside pointers.
+
* glib/testglib.c: Print sizeof() results
as g_print("%ld", (glong)sizeof(foo)), to deal with
size_t being long on Alpha's.
Tue May 12 16:54:15 1998 Owen Taylor <otaylor@gtk.org>
(James A <jamesa@demon.net> : gtk-jamesa-980511-4.patch)
-
+
* glib.h gstring.c gmessages.c: Added some missing
const to arguments.
@@ -611,8 +641,8 @@ Fri May 1 16:36:08 1998 Owen Taylor <otaylor@gtk.org>
Thu Apr 30 21:41:30 1998 Owen Taylor <otaylor@gtk.org>
- * gstring.c : Check arguments more carefully,
- (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
+ * gstring.c : Check arguments more carefully,
+ (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
Tue Apr 7 19:36:48 1998 Owen Taylor <owt1@cornell.edu>
@@ -638,7 +668,7 @@ Fri Apr 3 18:05:45 1998 Owen Taylor <owt1@cornell.edu>
* testglib.c: Removed literal german from strings
to appease SGI compiler.
-
+
Thu Mar 26 20:47:21 1998 Owen Taylor <owt1@cornell.edu>
* configure.in glib glibconfig.h.in: Add test for atexit/on_exit -
@@ -689,7 +719,7 @@ Mon Mar 2 17:51:18 1998 Owen Taylor <owt1@cornell.edu>
to take gchar* not guchar*
* testglib.c: Remove trailing ; after functions
-
+
Sun Mar 1 19:04:40 1998 Owen Taylor <owt1@cornell.edu>
* glib.h gstring.c: Added g_string_insert[_c]()
@@ -761,7 +791,7 @@ Sat Jan 17 23:52:40 1998 Owen Taylor <owt1@cornell.edu>
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
And const corrected. Old functions left in for now.
-
+
Fri Jan 9 20:03:46 1998 Tim Janik <timj@psynet.net>
* gutils.c (g_strerror): changed message for EAGAIN from
@@ -789,8 +819,8 @@ Sat Jan 3 20:23:25 1998 Owen Taylor <owt1@cornell.edu>
Fri Jan 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack.
@@ -822,8 +852,8 @@ Mon Dec 15 19:33:58 1997 Tim Janik <timj@psynet.net>
Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: this file now gets concatenated by makeglib_h from
glib_pre1.h and glib_pre2.h to merge in glibconfig.h wich got
created by configure (done by Jay Painter).
@@ -831,7 +861,7 @@ Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
* glib_pre2.h: the g_assert*() and g_return_*_fail() macros
are wrapped by G_STMT_START and G_STMT_END now, to avoid conflicts
when used within if (...) g_macro(); else ... conditionals.
-
+
Tue Dec 17 13:14:07 1996 Peter Mattis <pmattis@charnley.HIP.Berkeley.EDU>
* glib.h: Changed 'g_return_if_fail' and 'g_return_val_if_fail' to
diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12
index 4d42396ea..95fb3b9b8 100644
--- a/ChangeLog.pre-2-12
+++ b/ChangeLog.pre-2-12
@@ -1,3 +1,33 @@
+Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
+
+ * testglib.c (main): Update the array tests. Reduce the number of
+ iterations for the prepend test from 10000 to 100 since it is
+ O(n^2) and was taking longer than I would like to wait.
+
+ * garray.c: I've worked on the GArray interface, mostly. It was
+ seriously broken before and I hate to do it, but this is going to
+ break some code. It is important to do this now, because more and
+ more people are starting to use glib and the interface was both
+ broken and inconsistent. First, rename the _truncate functions of
+ both the GArray and GPtrArray classes to _set_size, since this
+ function can also be used to extend the arrays. GArray now
+ accepts two more initialization arguments: clear and element_size.
+ Instead of providing the type to each access function, the array
+ now stores the element size. Clear, if set, causes the library to
+ zero element's memory as the array expands. The major broken-ness
+ here was that array->len was in bytes, not elements. Now, since
+ the array knows its element size, array->len is correct and I have
+ removed the g_array_length macro. The only macro which now
+ accepts the type as an argument is g_array_index, which casts the
+ element to the right type--this interface does not change. The
+ append and prepend functions simply need the types removed.
+ g_ptr_array_remove_index now returns the removed element.
+
+ * gprimes.c (g_spaced_primes_closest): Move this function out of
+ ghash.c and rename it from g_hash_closest_prime. Fix the primes
+ so that they are actually prime (they weren't all -- isn't that
+ nice?).
+
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
@@ -26,8 +56,8 @@ Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
- * gmessages.c:
- (g_logv):
+ * gmessages.c:
+ (g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
@@ -109,7 +139,7 @@ Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
gint64 itself, packages that need gint64 should test for this
themselves.
- * glib.h:
+ * glib.h:
* gutils.c: added a new function g_vsnprintf().
Sun Aug 16 Elliot Lee
@@ -148,13 +178,13 @@ Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
in other required places.
* gnode.c:
- (g_node_prepend):
- (g_node_insert_before):
- (g_node_insert):
+ (g_node_prepend):
+ (g_node_insert_before):
+ (g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
- (g_node_insert_data):
+ (g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
@@ -211,7 +241,7 @@ Tue Aug 4 15:17:54 1998 Tim Janik <timj@gtk.org>
Mon Aug 3 16:02:26 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gnode.c: change order of gpointer data; field in struct _GNode to
be partly binary compatible with GList and GSList.
@@ -228,7 +258,7 @@ Fri Jul 31 09:08:16 1998 Tim Janik <timj@gtk.org>
* Makefile.am: compile gnode.c.
- * glib.h:
+ * glib.h:
* gnode.c: added implementation of n-way trees.
* gtree.c (g_tree_traverse): added a warning to the switch() statement
@@ -245,14 +275,14 @@ Mon Jul 27 01:02:27 1998 Tim Janik <timj@gtk.org>
implementation.
Sat Jul 25 16:09:00 1998 Mark Crichton <crichton@expert.cc.purdue.edu>
-
- * glib.h: gtime changed to g_time. gtime is used in
+
+ * glib.h: gtime changed to g_time. gtime is used in
/usr/include/time.h in NetBSD, causing multiple headaches.
If this isn't the right way of fixing it.... ;)
Thu Jul 23 00:29:14 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gscanner.c: new functions to make a scanner scope sensitive wrt
symbol lookups.
g_scanner_scope_foreach_symbol, g_scanner_scope_lookup_symbol,
@@ -273,7 +303,7 @@ Tue Jul 14 09:05:18 1998 Tim Janik <timj@gtk.org>
Fri Jul 10 06:33:43 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gutils.h: added a bunch of utility/wrapper functions:
g_basename(), g_getcwd(), g_get_user_name(), g_get_real_name(),
g_get_home_dir(), g_get_tmp_dir(), g_get_prgname() and g_set_prgname().
@@ -396,7 +426,7 @@ Thu Jun 11 04:15:31 1998 Tim Janik <timj@gtk.org>
Wed Jun 10 19:29:51 1998 Owen Taylor <otaylor@gtk.org>
* Makefile.am glib.m4 configure.in:
-
+
Moved out from GTK+; added AM_PATH_GLIB macro.
Wed Jun 10 12:56:07 1998 Owen Taylor <otaylor@gtk.org>
@@ -411,7 +441,7 @@ Sat May 23 19:00:01 1998 Owen Taylor <otaylor@gtk.org>
[ Combination of:
gtk-rrh-980412-0.patch (Raja R Harinath <harinath@cs.umn.edu>)
gtk-jbuhler-980516-0 (Jeremy Buhler <jbuhler@cs.washington.edu>) ]
-
+
* glib.h ghash.c gstring.c gdataset.c gutils.c:
- Added new typedef g_const_pointer; expunged all incorrect
uses of 'const gpointer'.
@@ -433,7 +463,7 @@ Sat Jun 6 14:09:22 PDT 1998 Manish Singh <yosh@gimp.org>
Wed Jun 3 06:19:42 1998 Tim Janik <timj@gtk.org>
- * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
+ * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
like g_chunk_new() with additional 0 initialization.
Mon Jun 1 04:43:27 1998 Tim Janik <timj@gtk.org>
@@ -451,7 +481,7 @@ Tue May 26 18:30:06 1998 Tim Janik <timj@gtk.org>
Mon May 18 22:14:39 1998 Owen Taylor <otaylor@gtk.org>
(Yasuhiro SHIRASAKI <joke@awa.tohoku.ac.jp> : gtk-joke-980517-0.patch)
-
+
* gutils.c: Restored a missing prototype for g_vsprintf.
Wed May 20 05:02:26 1998 Tim Janik <timj@gtk.org>
@@ -506,15 +536,15 @@ Tue May 12 19:22:58 1998 Owen Taylor <otaylor@gtk.org>
* glib/glib.h: Added macros G[U]INT_TO_POINTER() and
GPOINTER_TO_[U]INT for storing small integers integers
- inside pointers.
-
+ inside pointers.
+
* glib/testglib.c: Print sizeof() results
as g_print("%ld", (glong)sizeof(foo)), to deal with
size_t being long on Alpha's.
Tue May 12 16:54:15 1998 Owen Taylor <otaylor@gtk.org>
(James A <jamesa@demon.net> : gtk-jamesa-980511-4.patch)
-
+
* glib.h gstring.c gmessages.c: Added some missing
const to arguments.
@@ -611,8 +641,8 @@ Fri May 1 16:36:08 1998 Owen Taylor <otaylor@gtk.org>
Thu Apr 30 21:41:30 1998 Owen Taylor <otaylor@gtk.org>
- * gstring.c : Check arguments more carefully,
- (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
+ * gstring.c : Check arguments more carefully,
+ (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
Tue Apr 7 19:36:48 1998 Owen Taylor <owt1@cornell.edu>
@@ -638,7 +668,7 @@ Fri Apr 3 18:05:45 1998 Owen Taylor <owt1@cornell.edu>
* testglib.c: Removed literal german from strings
to appease SGI compiler.
-
+
Thu Mar 26 20:47:21 1998 Owen Taylor <owt1@cornell.edu>
* configure.in glib glibconfig.h.in: Add test for atexit/on_exit -
@@ -689,7 +719,7 @@ Mon Mar 2 17:51:18 1998 Owen Taylor <owt1@cornell.edu>
to take gchar* not guchar*
* testglib.c: Remove trailing ; after functions
-
+
Sun Mar 1 19:04:40 1998 Owen Taylor <owt1@cornell.edu>
* glib.h gstring.c: Added g_string_insert[_c]()
@@ -761,7 +791,7 @@ Sat Jan 17 23:52:40 1998 Owen Taylor <owt1@cornell.edu>
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
And const corrected. Old functions left in for now.
-
+
Fri Jan 9 20:03:46 1998 Tim Janik <timj@psynet.net>
* gutils.c (g_strerror): changed message for EAGAIN from
@@ -789,8 +819,8 @@ Sat Jan 3 20:23:25 1998 Owen Taylor <owt1@cornell.edu>
Fri Jan 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack.
@@ -822,8 +852,8 @@ Mon Dec 15 19:33:58 1997 Tim Janik <timj@psynet.net>
Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: this file now gets concatenated by makeglib_h from
glib_pre1.h and glib_pre2.h to merge in glibconfig.h wich got
created by configure (done by Jay Painter).
@@ -831,7 +861,7 @@ Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
* glib_pre2.h: the g_assert*() and g_return_*_fail() macros
are wrapped by G_STMT_START and G_STMT_END now, to avoid conflicts
when used within if (...) g_macro(); else ... conditionals.
-
+
Tue Dec 17 13:14:07 1996 Peter Mattis <pmattis@charnley.HIP.Berkeley.EDU>
* glib.h: Changed 'g_return_if_fail' and 'g_return_val_if_fail' to
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 4d42396ea..95fb3b9b8 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,33 @@
+Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
+
+ * testglib.c (main): Update the array tests. Reduce the number of
+ iterations for the prepend test from 10000 to 100 since it is
+ O(n^2) and was taking longer than I would like to wait.
+
+ * garray.c: I've worked on the GArray interface, mostly. It was
+ seriously broken before and I hate to do it, but this is going to
+ break some code. It is important to do this now, because more and
+ more people are starting to use glib and the interface was both
+ broken and inconsistent. First, rename the _truncate functions of
+ both the GArray and GPtrArray classes to _set_size, since this
+ function can also be used to extend the arrays. GArray now
+ accepts two more initialization arguments: clear and element_size.
+ Instead of providing the type to each access function, the array
+ now stores the element size. Clear, if set, causes the library to
+ zero element's memory as the array expands. The major broken-ness
+ here was that array->len was in bytes, not elements. Now, since
+ the array knows its element size, array->len is correct and I have
+ removed the g_array_length macro. The only macro which now
+ accepts the type as an argument is g_array_index, which casts the
+ element to the right type--this interface does not change. The
+ append and prepend functions simply need the types removed.
+ g_ptr_array_remove_index now returns the removed element.
+
+ * gprimes.c (g_spaced_primes_closest): Move this function out of
+ ghash.c and rename it from g_hash_closest_prime. Fix the primes
+ so that they are actually prime (they weren't all -- isn't that
+ nice?).
+
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
@@ -26,8 +56,8 @@ Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
- * gmessages.c:
- (g_logv):
+ * gmessages.c:
+ (g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
@@ -109,7 +139,7 @@ Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
gint64 itself, packages that need gint64 should test for this
themselves.
- * glib.h:
+ * glib.h:
* gutils.c: added a new function g_vsnprintf().
Sun Aug 16 Elliot Lee
@@ -148,13 +178,13 @@ Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
in other required places.
* gnode.c:
- (g_node_prepend):
- (g_node_insert_before):
- (g_node_insert):
+ (g_node_prepend):
+ (g_node_insert_before):
+ (g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
- (g_node_insert_data):
+ (g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
@@ -211,7 +241,7 @@ Tue Aug 4 15:17:54 1998 Tim Janik <timj@gtk.org>
Mon Aug 3 16:02:26 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gnode.c: change order of gpointer data; field in struct _GNode to
be partly binary compatible with GList and GSList.
@@ -228,7 +258,7 @@ Fri Jul 31 09:08:16 1998 Tim Janik <timj@gtk.org>
* Makefile.am: compile gnode.c.
- * glib.h:
+ * glib.h:
* gnode.c: added implementation of n-way trees.
* gtree.c (g_tree_traverse): added a warning to the switch() statement
@@ -245,14 +275,14 @@ Mon Jul 27 01:02:27 1998 Tim Janik <timj@gtk.org>
implementation.
Sat Jul 25 16:09:00 1998 Mark Crichton <crichton@expert.cc.purdue.edu>
-
- * glib.h: gtime changed to g_time. gtime is used in
+
+ * glib.h: gtime changed to g_time. gtime is used in
/usr/include/time.h in NetBSD, causing multiple headaches.
If this isn't the right way of fixing it.... ;)
Thu Jul 23 00:29:14 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gscanner.c: new functions to make a scanner scope sensitive wrt
symbol lookups.
g_scanner_scope_foreach_symbol, g_scanner_scope_lookup_symbol,
@@ -273,7 +303,7 @@ Tue Jul 14 09:05:18 1998 Tim Janik <timj@gtk.org>
Fri Jul 10 06:33:43 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gutils.h: added a bunch of utility/wrapper functions:
g_basename(), g_getcwd(), g_get_user_name(), g_get_real_name(),
g_get_home_dir(), g_get_tmp_dir(), g_get_prgname() and g_set_prgname().
@@ -396,7 +426,7 @@ Thu Jun 11 04:15:31 1998 Tim Janik <timj@gtk.org>
Wed Jun 10 19:29:51 1998 Owen Taylor <otaylor@gtk.org>
* Makefile.am glib.m4 configure.in:
-
+
Moved out from GTK+; added AM_PATH_GLIB macro.
Wed Jun 10 12:56:07 1998 Owen Taylor <otaylor@gtk.org>
@@ -411,7 +441,7 @@ Sat May 23 19:00:01 1998 Owen Taylor <otaylor@gtk.org>
[ Combination of:
gtk-rrh-980412-0.patch (Raja R Harinath <harinath@cs.umn.edu>)
gtk-jbuhler-980516-0 (Jeremy Buhler <jbuhler@cs.washington.edu>) ]
-
+
* glib.h ghash.c gstring.c gdataset.c gutils.c:
- Added new typedef g_const_pointer; expunged all incorrect
uses of 'const gpointer'.
@@ -433,7 +463,7 @@ Sat Jun 6 14:09:22 PDT 1998 Manish Singh <yosh@gimp.org>
Wed Jun 3 06:19:42 1998 Tim Janik <timj@gtk.org>
- * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
+ * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
like g_chunk_new() with additional 0 initialization.
Mon Jun 1 04:43:27 1998 Tim Janik <timj@gtk.org>
@@ -451,7 +481,7 @@ Tue May 26 18:30:06 1998 Tim Janik <timj@gtk.org>
Mon May 18 22:14:39 1998 Owen Taylor <otaylor@gtk.org>
(Yasuhiro SHIRASAKI <joke@awa.tohoku.ac.jp> : gtk-joke-980517-0.patch)
-
+
* gutils.c: Restored a missing prototype for g_vsprintf.
Wed May 20 05:02:26 1998 Tim Janik <timj@gtk.org>
@@ -506,15 +536,15 @@ Tue May 12 19:22:58 1998 Owen Taylor <otaylor@gtk.org>
* glib/glib.h: Added macros G[U]INT_TO_POINTER() and
GPOINTER_TO_[U]INT for storing small integers integers
- inside pointers.
-
+ inside pointers.
+
* glib/testglib.c: Print sizeof() results
as g_print("%ld", (glong)sizeof(foo)), to deal with
size_t being long on Alpha's.
Tue May 12 16:54:15 1998 Owen Taylor <otaylor@gtk.org>
(James A <jamesa@demon.net> : gtk-jamesa-980511-4.patch)
-
+
* glib.h gstring.c gmessages.c: Added some missing
const to arguments.
@@ -611,8 +641,8 @@ Fri May 1 16:36:08 1998 Owen Taylor <otaylor@gtk.org>
Thu Apr 30 21:41:30 1998 Owen Taylor <otaylor@gtk.org>
- * gstring.c : Check arguments more carefully,
- (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
+ * gstring.c : Check arguments more carefully,
+ (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
Tue Apr 7 19:36:48 1998 Owen Taylor <owt1@cornell.edu>
@@ -638,7 +668,7 @@ Fri Apr 3 18:05:45 1998 Owen Taylor <owt1@cornell.edu>
* testglib.c: Removed literal german from strings
to appease SGI compiler.
-
+
Thu Mar 26 20:47:21 1998 Owen Taylor <owt1@cornell.edu>
* configure.in glib glibconfig.h.in: Add test for atexit/on_exit -
@@ -689,7 +719,7 @@ Mon Mar 2 17:51:18 1998 Owen Taylor <owt1@cornell.edu>
to take gchar* not guchar*
* testglib.c: Remove trailing ; after functions
-
+
Sun Mar 1 19:04:40 1998 Owen Taylor <owt1@cornell.edu>
* glib.h gstring.c: Added g_string_insert[_c]()
@@ -761,7 +791,7 @@ Sat Jan 17 23:52:40 1998 Owen Taylor <owt1@cornell.edu>
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
And const corrected. Old functions left in for now.
-
+
Fri Jan 9 20:03:46 1998 Tim Janik <timj@psynet.net>
* gutils.c (g_strerror): changed message for EAGAIN from
@@ -789,8 +819,8 @@ Sat Jan 3 20:23:25 1998 Owen Taylor <owt1@cornell.edu>
Fri Jan 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack.
@@ -822,8 +852,8 @@ Mon Dec 15 19:33:58 1997 Tim Janik <timj@psynet.net>
Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: this file now gets concatenated by makeglib_h from
glib_pre1.h and glib_pre2.h to merge in glibconfig.h wich got
created by configure (done by Jay Painter).
@@ -831,7 +861,7 @@ Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
* glib_pre2.h: the g_assert*() and g_return_*_fail() macros
are wrapped by G_STMT_START and G_STMT_END now, to avoid conflicts
when used within if (...) g_macro(); else ... conditionals.
-
+
Tue Dec 17 13:14:07 1996 Peter Mattis <pmattis@charnley.HIP.Berkeley.EDU>
* glib.h: Changed 'g_return_if_fail' and 'g_return_val_if_fail' to
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 4d42396ea..95fb3b9b8 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,33 @@
+Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
+
+ * testglib.c (main): Update the array tests. Reduce the number of
+ iterations for the prepend test from 10000 to 100 since it is
+ O(n^2) and was taking longer than I would like to wait.
+
+ * garray.c: I've worked on the GArray interface, mostly. It was
+ seriously broken before and I hate to do it, but this is going to
+ break some code. It is important to do this now, because more and
+ more people are starting to use glib and the interface was both
+ broken and inconsistent. First, rename the _truncate functions of
+ both the GArray and GPtrArray classes to _set_size, since this
+ function can also be used to extend the arrays. GArray now
+ accepts two more initialization arguments: clear and element_size.
+ Instead of providing the type to each access function, the array
+ now stores the element size. Clear, if set, causes the library to
+ zero element's memory as the array expands. The major broken-ness
+ here was that array->len was in bytes, not elements. Now, since
+ the array knows its element size, array->len is correct and I have
+ removed the g_array_length macro. The only macro which now
+ accepts the type as an argument is g_array_index, which casts the
+ element to the right type--this interface does not change. The
+ append and prepend functions simply need the types removed.
+ g_ptr_array_remove_index now returns the removed element.
+
+ * gprimes.c (g_spaced_primes_closest): Move this function out of
+ ghash.c and rename it from g_hash_closest_prime. Fix the primes
+ so that they are actually prime (they weren't all -- isn't that
+ nice?).
+
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
@@ -26,8 +56,8 @@ Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
- * gmessages.c:
- (g_logv):
+ * gmessages.c:
+ (g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
@@ -109,7 +139,7 @@ Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
gint64 itself, packages that need gint64 should test for this
themselves.
- * glib.h:
+ * glib.h:
* gutils.c: added a new function g_vsnprintf().
Sun Aug 16 Elliot Lee
@@ -148,13 +178,13 @@ Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
in other required places.
* gnode.c:
- (g_node_prepend):
- (g_node_insert_before):
- (g_node_insert):
+ (g_node_prepend):
+ (g_node_insert_before):
+ (g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
- (g_node_insert_data):
+ (g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
@@ -211,7 +241,7 @@ Tue Aug 4 15:17:54 1998 Tim Janik <timj@gtk.org>
Mon Aug 3 16:02:26 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gnode.c: change order of gpointer data; field in struct _GNode to
be partly binary compatible with GList and GSList.
@@ -228,7 +258,7 @@ Fri Jul 31 09:08:16 1998 Tim Janik <timj@gtk.org>
* Makefile.am: compile gnode.c.
- * glib.h:
+ * glib.h:
* gnode.c: added implementation of n-way trees.
* gtree.c (g_tree_traverse): added a warning to the switch() statement
@@ -245,14 +275,14 @@ Mon Jul 27 01:02:27 1998 Tim Janik <timj@gtk.org>
implementation.
Sat Jul 25 16:09:00 1998 Mark Crichton <crichton@expert.cc.purdue.edu>
-
- * glib.h: gtime changed to g_time. gtime is used in
+
+ * glib.h: gtime changed to g_time. gtime is used in
/usr/include/time.h in NetBSD, causing multiple headaches.
If this isn't the right way of fixing it.... ;)
Thu Jul 23 00:29:14 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gscanner.c: new functions to make a scanner scope sensitive wrt
symbol lookups.
g_scanner_scope_foreach_symbol, g_scanner_scope_lookup_symbol,
@@ -273,7 +303,7 @@ Tue Jul 14 09:05:18 1998 Tim Janik <timj@gtk.org>
Fri Jul 10 06:33:43 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gutils.h: added a bunch of utility/wrapper functions:
g_basename(), g_getcwd(), g_get_user_name(), g_get_real_name(),
g_get_home_dir(), g_get_tmp_dir(), g_get_prgname() and g_set_prgname().
@@ -396,7 +426,7 @@ Thu Jun 11 04:15:31 1998 Tim Janik <timj@gtk.org>
Wed Jun 10 19:29:51 1998 Owen Taylor <otaylor@gtk.org>
* Makefile.am glib.m4 configure.in:
-
+
Moved out from GTK+; added AM_PATH_GLIB macro.
Wed Jun 10 12:56:07 1998 Owen Taylor <otaylor@gtk.org>
@@ -411,7 +441,7 @@ Sat May 23 19:00:01 1998 Owen Taylor <otaylor@gtk.org>
[ Combination of:
gtk-rrh-980412-0.patch (Raja R Harinath <harinath@cs.umn.edu>)
gtk-jbuhler-980516-0 (Jeremy Buhler <jbuhler@cs.washington.edu>) ]
-
+
* glib.h ghash.c gstring.c gdataset.c gutils.c:
- Added new typedef g_const_pointer; expunged all incorrect
uses of 'const gpointer'.
@@ -433,7 +463,7 @@ Sat Jun 6 14:09:22 PDT 1998 Manish Singh <yosh@gimp.org>
Wed Jun 3 06:19:42 1998 Tim Janik <timj@gtk.org>
- * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
+ * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
like g_chunk_new() with additional 0 initialization.
Mon Jun 1 04:43:27 1998 Tim Janik <timj@gtk.org>
@@ -451,7 +481,7 @@ Tue May 26 18:30:06 1998 Tim Janik <timj@gtk.org>
Mon May 18 22:14:39 1998 Owen Taylor <otaylor@gtk.org>
(Yasuhiro SHIRASAKI <joke@awa.tohoku.ac.jp> : gtk-joke-980517-0.patch)
-
+
* gutils.c: Restored a missing prototype for g_vsprintf.
Wed May 20 05:02:26 1998 Tim Janik <timj@gtk.org>
@@ -506,15 +536,15 @@ Tue May 12 19:22:58 1998 Owen Taylor <otaylor@gtk.org>
* glib/glib.h: Added macros G[U]INT_TO_POINTER() and
GPOINTER_TO_[U]INT for storing small integers integers
- inside pointers.
-
+ inside pointers.
+
* glib/testglib.c: Print sizeof() results
as g_print("%ld", (glong)sizeof(foo)), to deal with
size_t being long on Alpha's.
Tue May 12 16:54:15 1998 Owen Taylor <otaylor@gtk.org>
(James A <jamesa@demon.net> : gtk-jamesa-980511-4.patch)
-
+
* glib.h gstring.c gmessages.c: Added some missing
const to arguments.
@@ -611,8 +641,8 @@ Fri May 1 16:36:08 1998 Owen Taylor <otaylor@gtk.org>
Thu Apr 30 21:41:30 1998 Owen Taylor <otaylor@gtk.org>
- * gstring.c : Check arguments more carefully,
- (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
+ * gstring.c : Check arguments more carefully,
+ (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
Tue Apr 7 19:36:48 1998 Owen Taylor <owt1@cornell.edu>
@@ -638,7 +668,7 @@ Fri Apr 3 18:05:45 1998 Owen Taylor <owt1@cornell.edu>
* testglib.c: Removed literal german from strings
to appease SGI compiler.
-
+
Thu Mar 26 20:47:21 1998 Owen Taylor <owt1@cornell.edu>
* configure.in glib glibconfig.h.in: Add test for atexit/on_exit -
@@ -689,7 +719,7 @@ Mon Mar 2 17:51:18 1998 Owen Taylor <owt1@cornell.edu>
to take gchar* not guchar*
* testglib.c: Remove trailing ; after functions
-
+
Sun Mar 1 19:04:40 1998 Owen Taylor <owt1@cornell.edu>
* glib.h gstring.c: Added g_string_insert[_c]()
@@ -761,7 +791,7 @@ Sat Jan 17 23:52:40 1998 Owen Taylor <owt1@cornell.edu>
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
And const corrected. Old functions left in for now.
-
+
Fri Jan 9 20:03:46 1998 Tim Janik <timj@psynet.net>
* gutils.c (g_strerror): changed message for EAGAIN from
@@ -789,8 +819,8 @@ Sat Jan 3 20:23:25 1998 Owen Taylor <owt1@cornell.edu>
Fri Jan 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack.
@@ -822,8 +852,8 @@ Mon Dec 15 19:33:58 1997 Tim Janik <timj@psynet.net>
Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: this file now gets concatenated by makeglib_h from
glib_pre1.h and glib_pre2.h to merge in glibconfig.h wich got
created by configure (done by Jay Painter).
@@ -831,7 +861,7 @@ Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
* glib_pre2.h: the g_assert*() and g_return_*_fail() macros
are wrapped by G_STMT_START and G_STMT_END now, to avoid conflicts
when used within if (...) g_macro(); else ... conditionals.
-
+
Tue Dec 17 13:14:07 1996 Peter Mattis <pmattis@charnley.HIP.Berkeley.EDU>
* glib.h: Changed 'g_return_if_fail' and 'g_return_val_if_fail' to
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 4d42396ea..95fb3b9b8 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,33 @@
+Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
+
+ * testglib.c (main): Update the array tests. Reduce the number of
+ iterations for the prepend test from 10000 to 100 since it is
+ O(n^2) and was taking longer than I would like to wait.
+
+ * garray.c: I've worked on the GArray interface, mostly. It was
+ seriously broken before and I hate to do it, but this is going to
+ break some code. It is important to do this now, because more and
+ more people are starting to use glib and the interface was both
+ broken and inconsistent. First, rename the _truncate functions of
+ both the GArray and GPtrArray classes to _set_size, since this
+ function can also be used to extend the arrays. GArray now
+ accepts two more initialization arguments: clear and element_size.
+ Instead of providing the type to each access function, the array
+ now stores the element size. Clear, if set, causes the library to
+ zero element's memory as the array expands. The major broken-ness
+ here was that array->len was in bytes, not elements. Now, since
+ the array knows its element size, array->len is correct and I have
+ removed the g_array_length macro. The only macro which now
+ accepts the type as an argument is g_array_index, which casts the
+ element to the right type--this interface does not change. The
+ append and prepend functions simply need the types removed.
+ g_ptr_array_remove_index now returns the removed element.
+
+ * gprimes.c (g_spaced_primes_closest): Move this function out of
+ ghash.c and rename it from g_hash_closest_prime. Fix the primes
+ so that they are actually prime (they weren't all -- isn't that
+ nice?).
+
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
@@ -26,8 +56,8 @@ Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
- * gmessages.c:
- (g_logv):
+ * gmessages.c:
+ (g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
@@ -109,7 +139,7 @@ Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
gint64 itself, packages that need gint64 should test for this
themselves.
- * glib.h:
+ * glib.h:
* gutils.c: added a new function g_vsnprintf().
Sun Aug 16 Elliot Lee
@@ -148,13 +178,13 @@ Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
in other required places.
* gnode.c:
- (g_node_prepend):
- (g_node_insert_before):
- (g_node_insert):
+ (g_node_prepend):
+ (g_node_insert_before):
+ (g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
- (g_node_insert_data):
+ (g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
@@ -211,7 +241,7 @@ Tue Aug 4 15:17:54 1998 Tim Janik <timj@gtk.org>
Mon Aug 3 16:02:26 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gnode.c: change order of gpointer data; field in struct _GNode to
be partly binary compatible with GList and GSList.
@@ -228,7 +258,7 @@ Fri Jul 31 09:08:16 1998 Tim Janik <timj@gtk.org>
* Makefile.am: compile gnode.c.
- * glib.h:
+ * glib.h:
* gnode.c: added implementation of n-way trees.
* gtree.c (g_tree_traverse): added a warning to the switch() statement
@@ -245,14 +275,14 @@ Mon Jul 27 01:02:27 1998 Tim Janik <timj@gtk.org>
implementation.
Sat Jul 25 16:09:00 1998 Mark Crichton <crichton@expert.cc.purdue.edu>
-
- * glib.h: gtime changed to g_time. gtime is used in
+
+ * glib.h: gtime changed to g_time. gtime is used in
/usr/include/time.h in NetBSD, causing multiple headaches.
If this isn't the right way of fixing it.... ;)
Thu Jul 23 00:29:14 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gscanner.c: new functions to make a scanner scope sensitive wrt
symbol lookups.
g_scanner_scope_foreach_symbol, g_scanner_scope_lookup_symbol,
@@ -273,7 +303,7 @@ Tue Jul 14 09:05:18 1998 Tim Janik <timj@gtk.org>
Fri Jul 10 06:33:43 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gutils.h: added a bunch of utility/wrapper functions:
g_basename(), g_getcwd(), g_get_user_name(), g_get_real_name(),
g_get_home_dir(), g_get_tmp_dir(), g_get_prgname() and g_set_prgname().
@@ -396,7 +426,7 @@ Thu Jun 11 04:15:31 1998 Tim Janik <timj@gtk.org>
Wed Jun 10 19:29:51 1998 Owen Taylor <otaylor@gtk.org>
* Makefile.am glib.m4 configure.in:
-
+
Moved out from GTK+; added AM_PATH_GLIB macro.
Wed Jun 10 12:56:07 1998 Owen Taylor <otaylor@gtk.org>
@@ -411,7 +441,7 @@ Sat May 23 19:00:01 1998 Owen Taylor <otaylor@gtk.org>
[ Combination of:
gtk-rrh-980412-0.patch (Raja R Harinath <harinath@cs.umn.edu>)
gtk-jbuhler-980516-0 (Jeremy Buhler <jbuhler@cs.washington.edu>) ]
-
+
* glib.h ghash.c gstring.c gdataset.c gutils.c:
- Added new typedef g_const_pointer; expunged all incorrect
uses of 'const gpointer'.
@@ -433,7 +463,7 @@ Sat Jun 6 14:09:22 PDT 1998 Manish Singh <yosh@gimp.org>
Wed Jun 3 06:19:42 1998 Tim Janik <timj@gtk.org>
- * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
+ * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
like g_chunk_new() with additional 0 initialization.
Mon Jun 1 04:43:27 1998 Tim Janik <timj@gtk.org>
@@ -451,7 +481,7 @@ Tue May 26 18:30:06 1998 Tim Janik <timj@gtk.org>
Mon May 18 22:14:39 1998 Owen Taylor <otaylor@gtk.org>
(Yasuhiro SHIRASAKI <joke@awa.tohoku.ac.jp> : gtk-joke-980517-0.patch)
-
+
* gutils.c: Restored a missing prototype for g_vsprintf.
Wed May 20 05:02:26 1998 Tim Janik <timj@gtk.org>
@@ -506,15 +536,15 @@ Tue May 12 19:22:58 1998 Owen Taylor <otaylor@gtk.org>
* glib/glib.h: Added macros G[U]INT_TO_POINTER() and
GPOINTER_TO_[U]INT for storing small integers integers
- inside pointers.
-
+ inside pointers.
+
* glib/testglib.c: Print sizeof() results
as g_print("%ld", (glong)sizeof(foo)), to deal with
size_t being long on Alpha's.
Tue May 12 16:54:15 1998 Owen Taylor <otaylor@gtk.org>
(James A <jamesa@demon.net> : gtk-jamesa-980511-4.patch)
-
+
* glib.h gstring.c gmessages.c: Added some missing
const to arguments.
@@ -611,8 +641,8 @@ Fri May 1 16:36:08 1998 Owen Taylor <otaylor@gtk.org>
Thu Apr 30 21:41:30 1998 Owen Taylor <otaylor@gtk.org>
- * gstring.c : Check arguments more carefully,
- (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
+ * gstring.c : Check arguments more carefully,
+ (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
Tue Apr 7 19:36:48 1998 Owen Taylor <owt1@cornell.edu>
@@ -638,7 +668,7 @@ Fri Apr 3 18:05:45 1998 Owen Taylor <owt1@cornell.edu>
* testglib.c: Removed literal german from strings
to appease SGI compiler.
-
+
Thu Mar 26 20:47:21 1998 Owen Taylor <owt1@cornell.edu>
* configure.in glib glibconfig.h.in: Add test for atexit/on_exit -
@@ -689,7 +719,7 @@ Mon Mar 2 17:51:18 1998 Owen Taylor <owt1@cornell.edu>
to take gchar* not guchar*
* testglib.c: Remove trailing ; after functions
-
+
Sun Mar 1 19:04:40 1998 Owen Taylor <owt1@cornell.edu>
* glib.h gstring.c: Added g_string_insert[_c]()
@@ -761,7 +791,7 @@ Sat Jan 17 23:52:40 1998 Owen Taylor <owt1@cornell.edu>
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
And const corrected. Old functions left in for now.
-
+
Fri Jan 9 20:03:46 1998 Tim Janik <timj@psynet.net>
* gutils.c (g_strerror): changed message for EAGAIN from
@@ -789,8 +819,8 @@ Sat Jan 3 20:23:25 1998 Owen Taylor <owt1@cornell.edu>
Fri Jan 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack.
@@ -822,8 +852,8 @@ Mon Dec 15 19:33:58 1997 Tim Janik <timj@psynet.net>
Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: this file now gets concatenated by makeglib_h from
glib_pre1.h and glib_pre2.h to merge in glibconfig.h wich got
created by configure (done by Jay Painter).
@@ -831,7 +861,7 @@ Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
* glib_pre2.h: the g_assert*() and g_return_*_fail() macros
are wrapped by G_STMT_START and G_STMT_END now, to avoid conflicts
when used within if (...) g_macro(); else ... conditionals.
-
+
Tue Dec 17 13:14:07 1996 Peter Mattis <pmattis@charnley.HIP.Berkeley.EDU>
* glib.h: Changed 'g_return_if_fail' and 'g_return_val_if_fail' to
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 4d42396ea..95fb3b9b8 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,33 @@
+Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
+
+ * testglib.c (main): Update the array tests. Reduce the number of
+ iterations for the prepend test from 10000 to 100 since it is
+ O(n^2) and was taking longer than I would like to wait.
+
+ * garray.c: I've worked on the GArray interface, mostly. It was
+ seriously broken before and I hate to do it, but this is going to
+ break some code. It is important to do this now, because more and
+ more people are starting to use glib and the interface was both
+ broken and inconsistent. First, rename the _truncate functions of
+ both the GArray and GPtrArray classes to _set_size, since this
+ function can also be used to extend the arrays. GArray now
+ accepts two more initialization arguments: clear and element_size.
+ Instead of providing the type to each access function, the array
+ now stores the element size. Clear, if set, causes the library to
+ zero element's memory as the array expands. The major broken-ness
+ here was that array->len was in bytes, not elements. Now, since
+ the array knows its element size, array->len is correct and I have
+ removed the g_array_length macro. The only macro which now
+ accepts the type as an argument is g_array_index, which casts the
+ element to the right type--this interface does not change. The
+ append and prepend functions simply need the types removed.
+ g_ptr_array_remove_index now returns the removed element.
+
+ * gprimes.c (g_spaced_primes_closest): Move this function out of
+ ghash.c and rename it from g_hash_closest_prime. Fix the primes
+ so that they are actually prime (they weren't all -- isn't that
+ nice?).
+
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
@@ -26,8 +56,8 @@ Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
- * gmessages.c:
- (g_logv):
+ * gmessages.c:
+ (g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
@@ -109,7 +139,7 @@ Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
gint64 itself, packages that need gint64 should test for this
themselves.
- * glib.h:
+ * glib.h:
* gutils.c: added a new function g_vsnprintf().
Sun Aug 16 Elliot Lee
@@ -148,13 +178,13 @@ Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
in other required places.
* gnode.c:
- (g_node_prepend):
- (g_node_insert_before):
- (g_node_insert):
+ (g_node_prepend):
+ (g_node_insert_before):
+ (g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
- (g_node_insert_data):
+ (g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
@@ -211,7 +241,7 @@ Tue Aug 4 15:17:54 1998 Tim Janik <timj@gtk.org>
Mon Aug 3 16:02:26 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gnode.c: change order of gpointer data; field in struct _GNode to
be partly binary compatible with GList and GSList.
@@ -228,7 +258,7 @@ Fri Jul 31 09:08:16 1998 Tim Janik <timj@gtk.org>
* Makefile.am: compile gnode.c.
- * glib.h:
+ * glib.h:
* gnode.c: added implementation of n-way trees.
* gtree.c (g_tree_traverse): added a warning to the switch() statement
@@ -245,14 +275,14 @@ Mon Jul 27 01:02:27 1998 Tim Janik <timj@gtk.org>
implementation.
Sat Jul 25 16:09:00 1998 Mark Crichton <crichton@expert.cc.purdue.edu>
-
- * glib.h: gtime changed to g_time. gtime is used in
+
+ * glib.h: gtime changed to g_time. gtime is used in
/usr/include/time.h in NetBSD, causing multiple headaches.
If this isn't the right way of fixing it.... ;)
Thu Jul 23 00:29:14 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gscanner.c: new functions to make a scanner scope sensitive wrt
symbol lookups.
g_scanner_scope_foreach_symbol, g_scanner_scope_lookup_symbol,
@@ -273,7 +303,7 @@ Tue Jul 14 09:05:18 1998 Tim Janik <timj@gtk.org>
Fri Jul 10 06:33:43 1998 Tim Janik <timj@gtk.org>
- * glib.h:
+ * glib.h:
* gutils.h: added a bunch of utility/wrapper functions:
g_basename(), g_getcwd(), g_get_user_name(), g_get_real_name(),
g_get_home_dir(), g_get_tmp_dir(), g_get_prgname() and g_set_prgname().
@@ -396,7 +426,7 @@ Thu Jun 11 04:15:31 1998 Tim Janik <timj@gtk.org>
Wed Jun 10 19:29:51 1998 Owen Taylor <otaylor@gtk.org>
* Makefile.am glib.m4 configure.in:
-
+
Moved out from GTK+; added AM_PATH_GLIB macro.
Wed Jun 10 12:56:07 1998 Owen Taylor <otaylor@gtk.org>
@@ -411,7 +441,7 @@ Sat May 23 19:00:01 1998 Owen Taylor <otaylor@gtk.org>
[ Combination of:
gtk-rrh-980412-0.patch (Raja R Harinath <harinath@cs.umn.edu>)
gtk-jbuhler-980516-0 (Jeremy Buhler <jbuhler@cs.washington.edu>) ]
-
+
* glib.h ghash.c gstring.c gdataset.c gutils.c:
- Added new typedef g_const_pointer; expunged all incorrect
uses of 'const gpointer'.
@@ -433,7 +463,7 @@ Sat Jun 6 14:09:22 PDT 1998 Manish Singh <yosh@gimp.org>
Wed Jun 3 06:19:42 1998 Tim Janik <timj@gtk.org>
- * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
+ * glib.h (g_chunk_new0): convenience macro, for allocating small chunks
like g_chunk_new() with additional 0 initialization.
Mon Jun 1 04:43:27 1998 Tim Janik <timj@gtk.org>
@@ -451,7 +481,7 @@ Tue May 26 18:30:06 1998 Tim Janik <timj@gtk.org>
Mon May 18 22:14:39 1998 Owen Taylor <otaylor@gtk.org>
(Yasuhiro SHIRASAKI <joke@awa.tohoku.ac.jp> : gtk-joke-980517-0.patch)
-
+
* gutils.c: Restored a missing prototype for g_vsprintf.
Wed May 20 05:02:26 1998 Tim Janik <timj@gtk.org>
@@ -506,15 +536,15 @@ Tue May 12 19:22:58 1998 Owen Taylor <otaylor@gtk.org>
* glib/glib.h: Added macros G[U]INT_TO_POINTER() and
GPOINTER_TO_[U]INT for storing small integers integers
- inside pointers.
-
+ inside pointers.
+
* glib/testglib.c: Print sizeof() results
as g_print("%ld", (glong)sizeof(foo)), to deal with
size_t being long on Alpha's.
Tue May 12 16:54:15 1998 Owen Taylor <otaylor@gtk.org>
(James A <jamesa@demon.net> : gtk-jamesa-980511-4.patch)
-
+
* glib.h gstring.c gmessages.c: Added some missing
const to arguments.
@@ -611,8 +641,8 @@ Fri May 1 16:36:08 1998 Owen Taylor <otaylor@gtk.org>
Thu Apr 30 21:41:30 1998 Owen Taylor <otaylor@gtk.org>
- * gstring.c : Check arguments more carefully,
- (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
+ * gstring.c : Check arguments more carefully,
+ (gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
Tue Apr 7 19:36:48 1998 Owen Taylor <owt1@cornell.edu>
@@ -638,7 +668,7 @@ Fri Apr 3 18:05:45 1998 Owen Taylor <owt1@cornell.edu>
* testglib.c: Removed literal german from strings
to appease SGI compiler.
-
+
Thu Mar 26 20:47:21 1998 Owen Taylor <owt1@cornell.edu>
* configure.in glib glibconfig.h.in: Add test for atexit/on_exit -
@@ -689,7 +719,7 @@ Mon Mar 2 17:51:18 1998 Owen Taylor <owt1@cornell.edu>
to take gchar* not guchar*
* testglib.c: Remove trailing ; after functions
-
+
Sun Mar 1 19:04:40 1998 Owen Taylor <owt1@cornell.edu>
* glib.h gstring.c: Added g_string_insert[_c]()
@@ -761,7 +791,7 @@ Sat Jan 17 23:52:40 1998 Owen Taylor <owt1@cornell.edu>
renamed g_string_equal => g_str_equal
renamed g_string_hash => g_str_hash
And const corrected. Old functions left in for now.
-
+
Fri Jan 9 20:03:46 1998 Tim Janik <timj@psynet.net>
* gutils.c (g_strerror): changed message for EAGAIN from
@@ -789,8 +819,8 @@ Sat Jan 3 20:23:25 1998 Owen Taylor <owt1@cornell.edu>
Fri Jan 2 23:52 PST 1998 Jay Painter <jpaint@serv.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: reverted glibconfig.h and glib.h files back to the
way they were before my ugly hack.
@@ -822,8 +852,8 @@ Mon Dec 15 19:33:58 1997 Tim Janik <timj@psynet.net>
Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
- * glib_pre1.h:
- * glib_pre2.h:
+ * glib_pre1.h:
+ * glib_pre2.h:
* glib.h: this file now gets concatenated by makeglib_h from
glib_pre1.h and glib_pre2.h to merge in glibconfig.h wich got
created by configure (done by Jay Painter).
@@ -831,7 +861,7 @@ Wed Dec 10 23:27:20 1997 Tim Janik <timj@psynet.net>
* glib_pre2.h: the g_assert*() and g_return_*_fail() macros
are wrapped by G_STMT_START and G_STMT_END now, to avoid conflicts
when used within if (...) g_macro(); else ... conditionals.
-
+
Tue Dec 17 13:14:07 1996 Peter Mattis <pmattis@charnley.HIP.Berkeley.EDU>
* glib.h: Changed 'g_return_if_fail' and 'g_return_val_if_fail' to
diff --git a/garray.c b/garray.c
index 2429ab055..57cc68c30 100644
--- a/garray.c
+++ b/garray.c
@@ -30,7 +30,9 @@ struct _GRealArray
guint8 *data;
guint len;
guint alloc;
- guint zero_terminated;
+ guint elt_size;
+ guint zero_terminated : 1;
+ guint clear : 1;
};
@@ -43,7 +45,9 @@ static GMemChunk *array_mem_chunk = NULL;
GArray*
-g_array_new (gboolean zero_terminated)
+g_array_new (gboolean zero_terminated,
+ gboolean clear,
+ guint elt_size)
{
GRealArray *array;
@@ -54,10 +58,12 @@ g_array_new (gboolean zero_terminated)
array = g_chunk_new (GRealArray, array_mem_chunk);
- array->data = NULL;
- array->len = 0;
- array->alloc = 0;
+ array->data = NULL;
+ array->len = 0;
+ array->alloc = 0;
array->zero_terminated = (zero_terminated ? 1 : 0);
+ array->clear = (clear ? 1 : 0);
+ array->elt_size = elt_size;
return (GArray*) array;
}
@@ -73,45 +79,52 @@ g_array_free (GArray *array,
}
GArray*
-g_rarray_append (GArray *array,
- gpointer data,
- gint size)
+g_array_append_vals (GArray *farray,
+ gpointer data,
+ guint len)
{
- g_array_maybe_expand ((GRealArray*) array, size);
+ GRealArray *array = (GRealArray*) farray;
- memcpy (array->data + array->len, data, size);
+ g_array_maybe_expand (array, len);
- array->len += size;
+ memcpy (array->data + array->elt_size * array->len, data, array->elt_size * len);
- return array;
+ array->len += len;
+
+ return farray;
}
GArray*
-g_rarray_prepend (GArray *array,
- gpointer data,
- gint size)
+g_array_prepend_vals (GArray *farray,
+ gpointer data,
+ guint len)
{
- g_array_maybe_expand ((GRealArray*) array, size);
+ GRealArray *array = (GRealArray*) farray;
- g_memmove (array->data + size, array->data, array->len);
- memcpy (array->data, data, size);
+ g_array_maybe_expand (array, len);
- array->len += size;
+ g_memmove (array->data + array->elt_size * len, array->data, array->elt_size * array->len);
- return array;
+ memcpy (array->data, data, len * array->elt_size);
+
+ array->len += len;
+
+ return farray;
}
GArray*
-g_rarray_truncate (GArray *array,
- gint length,
- gint size)
+g_array_set_size (GArray *farray,
+ guint length)
{
- if (array->data)
- memset (array->data + length * size, 0, size);
- array->len = length * size;
- return array;
-}
+ GRealArray *array = (GRealArray*) farray;
+ if (array->len < length)
+ g_array_maybe_expand (array, length - array->len);
+
+ array->len = length;
+
+ return farray;
+}
static gint
g_nearest_pow (gint num)
@@ -128,17 +141,19 @@ static void
g_array_maybe_expand (GRealArray *array,
gint len)
{
- guint old_alloc;
+ guint want_alloc = (array->len + len + array->zero_terminated) * array->elt_size;
- if ((array->len + len) > array->alloc)
+ if (want_alloc > array->alloc)
{
- old_alloc = array->alloc;
+ guint old_alloc = array->alloc;
- array->alloc = g_nearest_pow (array->len + array->zero_terminated + len);
+ array->alloc = g_nearest_pow (want_alloc);
array->alloc = MAX (array->alloc, MIN_ARRAY_SIZE);
+
array->data = g_realloc (array->data, array->alloc);
- memset (array->data + old_alloc, 0, array->alloc - old_alloc);
+ if (array->clear || array->zero_terminated)
+ memset (array->data + old_alloc, 0, array->alloc - old_alloc);
}
}
@@ -228,21 +243,26 @@ g_ptr_array_set_size (GPtrArray *farray,
array->len = length;
}
-void
+gpointer
g_ptr_array_remove_index (GPtrArray* farray,
gint index)
{
GRealPtrArray* array = (GRealPtrArray*) farray;
+ gpointer result;
- g_return_if_fail (array);
+ g_return_val_if_fail (array, NULL);
- g_return_if_fail (index < array->len);
+ g_return_val_if_fail (index >= 0 && index < array->len, NULL);
+
+ result = array->pdata[index];
array->pdata[index] = array->pdata[array->len - 1];
array->pdata[array->len - 1] = NULL;
array->len -= 1;
+
+ return result;
}
gboolean
@@ -284,11 +304,11 @@ g_ptr_array_add (GPtrArray* farray,
GByteArray* g_byte_array_new (void)
{
- return (GByteArray*) g_array_new (FALSE);
+ return (GByteArray*) g_array_new (FALSE, FALSE, 1);
}
void g_byte_array_free (GByteArray *array,
- gint free_segment)
+ gboolean free_segment)
{
g_array_free ((GArray*) array, free_segment);
}
@@ -297,7 +317,7 @@ GByteArray* g_byte_array_append (GByteArray *array,
const guint8 *data,
guint len)
{
- g_rarray_append ((GArray*) array, (guint8*)data, len);
+ g_array_append_vals ((GArray*) array, (guint8*)data, len);
return array;
}
@@ -306,15 +326,15 @@ GByteArray* g_byte_array_prepend (GByteArray *array,
const guint8 *data,
guint len)
{
- g_rarray_prepend ((GArray*) array, (guint8*)data, len);
+ g_array_prepend_vals ((GArray*) array, (guint8*)data, len);
return array;
}
-GByteArray* g_byte_array_truncate (GByteArray *array,
- gint length)
+GByteArray* g_byte_array_set_size (GByteArray *array,
+ guint length)
{
- g_rarray_truncate ((GArray*) array, length, 1);
+ g_array_set_size ((GArray*) array, length);
return array;
}
diff --git a/ghash.c b/ghash.c
index ee1ca7f61..b2c3838dd 100644
--- a/ghash.c
+++ b/ghash.c
@@ -46,7 +46,6 @@ struct _GHashTable
static void g_hash_table_resize (GHashTable *hash_table);
static GHashNode** g_hash_table_lookup_node(GHashTable *hash_table,
gconstpointer key);
-static gint g_hash_closest_prime (gint num);
static GHashNode* g_hash_node_new (gpointer key,
gpointer value);
static void g_hash_node_destroy (GHashNode *hash_node);
@@ -63,7 +62,7 @@ g_hash_table_new (GHashFunc hash_func,
{
GHashTable *hash_table;
gint i;
-
+
hash_table = g_new (GHashTable, 1);
hash_table->size = HASH_TABLE_MIN_SIZE;
hash_table->nnodes = 0;
@@ -71,7 +70,7 @@ g_hash_table_new (GHashFunc hash_func,
hash_table->hash_func = hash_func ? hash_func : g_direct_hash;
hash_table->key_compare_func = key_compare_func;
hash_table->nodes = g_new (GHashNode*, hash_table->size);
-
+
for (i = 0; i < hash_table->size; i++)
hash_table->nodes[i] = NULL;
@@ -84,10 +83,10 @@ g_hash_table_destroy (GHashTable *hash_table)
gint i;
g_return_if_fail (hash_table);
-
+
for (i = 0; i < hash_table->size; i++)
g_hash_nodes_destroy (hash_table->nodes[i]);
-
+
g_free (hash_table->nodes);
g_free (hash_table);
}
@@ -100,7 +99,7 @@ g_hash_table_insert (GHashTable *hash_table,
GHashNode **node;
g_return_if_fail (hash_table);
-
+
node = g_hash_table_lookup_node (hash_table, key);
if (*node)
@@ -146,7 +145,7 @@ g_hash_table_lookup (GHashTable *hash_table,
gconstpointer key)
{
GHashNode *node;
-
+
g_return_val_if_fail (hash_table, NULL);
node = *g_hash_table_lookup_node (hash_table, key);
@@ -160,7 +159,7 @@ g_hash_table_lookup_extended (GHashTable *hash_table,
gpointer *value)
{
GHashNode *node;
-
+
g_return_val_if_fail (hash_table, FALSE);
node = *g_hash_table_lookup_node (hash_table, lookup_key);
@@ -232,19 +231,19 @@ g_hash_table_resize (GHashTable *hash_table)
g_return_if_fail (hash_table);
nodes_per_list = (gfloat) hash_table->nnodes / (gfloat) hash_table->size;
-
+
if ((nodes_per_list > 0.3 || hash_table->size <= HASH_TABLE_MIN_SIZE) &&
(nodes_per_list < 3.0 || hash_table->size >= HASH_TABLE_MAX_SIZE))
return;
- new_size = CLAMP(g_hash_closest_prime (hash_table->nnodes),
+ new_size = CLAMP(g_spaced_primes_closest (hash_table->nnodes),
HASH_TABLE_MIN_SIZE,
HASH_TABLE_MAX_SIZE);
new_nodes = g_new (GHashNode*, new_size);
-
+
for (i = 0; i < new_size; i++)
new_nodes[i] = NULL;
-
+
for (i = 0; i < hash_table->size; i++)
for (node = hash_table->nodes[i]; node; node = next)
{
@@ -253,7 +252,7 @@ g_hash_table_resize (GHashTable *hash_table)
node->next = new_nodes[hash_val];
new_nodes[hash_val] = node;
}
-
+
g_free (hash_table->nodes);
hash_table->nodes = new_nodes;
hash_table->size = new_size;
@@ -264,7 +263,7 @@ g_hash_table_lookup_node (GHashTable *hash_table,
gconstpointer key)
{
GHashNode **node;
-
+
g_return_val_if_fail (hash_table, NULL);
node = &hash_table->nodes
@@ -281,22 +280,8 @@ g_hash_table_lookup_node (GHashTable *hash_table,
else
while (*node && (*node)->key != key)
node = &(*node)->next;
-
- return node;
-}
-static gint
-g_hash_closest_prime (gint num)
-{
- extern gint g_primes[];
- extern gint g_nprimes;
- gint i;
-
- for (i = 0; i < g_nprimes; i++)
- if ((g_primes[i] - num) > 0)
- return g_primes[i];
-
- return g_primes[g_nprimes - 1];
+ return node;
}
static GHashNode*
diff --git a/glib.h b/glib.h
index 62ade5dcb..601153a29 100644
--- a/glib.h
+++ b/glib.h
@@ -241,7 +241,7 @@
# define ATEXIT(proc) (atexit (proc))
# elif defined (HAVE_ON_EXIT)
# define ATEXIT(proc) (on_exit ((void (*)(int, void *))(proc), NULL))
-# endif
+# endif
#endif /* ATEXIT */
@@ -438,9 +438,9 @@ typedef unsigned int guint;
typedef float gfloat;
typedef double gdouble;
-/* HAVE_LONG_DOUBLE doesn't work correctly on all platforms.
- * Since gldouble isn't used anywhere, just disable it for now
- */
+/* HAVE_LONG_DOUBLE doesn't work correctly on all platforms.
+ * Since gldouble isn't used anywhere, just disable it for now */
+
#if 0
#ifdef HAVE_LONG_DOUBLE
typedef long double gldouble;
@@ -575,7 +575,7 @@ typedef enum
/* log flags */
G_LOG_FLAG_RECURSION = 1 << 0,
G_LOG_FLAG_FATAL = 1 << 1,
-
+
/* GLib log levels */
G_LOG_LEVEL_ERROR = 1 << 2, /* always fatal */
G_LOG_LEVEL_CRITICAL = 1 << 3,
@@ -583,7 +583,7 @@ typedef enum
G_LOG_LEVEL_MESSAGE = 1 << 5,
G_LOG_LEVEL_INFO = 1 << 6,
G_LOG_LEVEL_DEBUG = 1 << 7,
-
+
G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL)
} GLogLevelFlags;
@@ -692,8 +692,8 @@ GList* g_list_insert (GList *list,
gint position);
GList* g_list_insert_sorted (GList *list,
gpointer data,
- GCompareFunc func);
-GList* g_list_concat (GList *list1,
+ GCompareFunc func);
+GList* g_list_concat (GList *list1,
GList *list2);
GList* g_list_remove (GList *list,
gpointer data);
@@ -737,8 +737,8 @@ GSList* g_slist_insert (GSList *list,
gint position);
GSList* g_slist_insert_sorted (GSList *list,
gpointer data,
- GCompareFunc func);
-GSList* g_slist_concat (GSList *list1,
+ GCompareFunc func);
+GSList* g_slist_concat (GSList *list1,
GSList *list2);
GSList* g_slist_remove (GSList *list,
gpointer data);
@@ -1159,8 +1159,8 @@ void g_set_prgname (const gchar *prgname);
/* Miscellaneous utility functions
*/
-guint g_parse_debug_string (const gchar *string,
- GDebugKey *keys,
+guint g_parse_debug_string (const gchar *string,
+ GDebugKey *keys,
guint nkeys);
gint g_snprintf (gchar *string,
gulong n,
@@ -1185,7 +1185,7 @@ gchar* g_get_current_dir (void);
#define g_memmove(dest, src, size) G_STMT_START { \
memmove ((dest), (src), (size)); \
} G_STMT_END
-#else
+#else
#define g_memmove(dest, src, size) G_STMT_START { \
bcopy ((src), (dest), (size)); \
} G_STMT_END
@@ -1226,7 +1226,7 @@ static inline guint
g_bit_storage (guint number)
{
register guint n_bits = 0;
-
+
do
{
n_bits++;
@@ -1264,14 +1264,14 @@ GString* g_string_prepend (GString *string,
const gchar *val);
GString* g_string_prepend_c (GString *string,
gchar c);
-GString* g_string_insert (GString *string,
- gint pos,
+GString* g_string_insert (GString *string,
+ gint pos,
const gchar *val);
-GString* g_string_insert_c (GString *string,
- gint pos,
+GString* g_string_insert_c (GString *string,
+ gint pos,
gchar c);
-GString* g_string_erase (GString *string,
- gint pos,
+GString* g_string_erase (GString *string,
+ gint pos,
gint len);
GString* g_string_down (GString *string);
GString* g_string_up (GString *string);
@@ -1285,34 +1285,24 @@ void g_string_sprintfa (GString *string,
/* Resizable arrays
*/
-#define g_array_length(array,type) \
- (((array)->len)/sizeof(type))
-#define g_array_append_val(array,type,val) \
- g_rarray_append (array, (gpointer) &val, sizeof (type))
-#define g_array_append_vals(array,type,vals,nvals) \
- g_rarray_append (array, (gpointer) vals, sizeof (type) * nvals)
-#define g_array_prepend_val(array,type,val) \
- g_rarray_prepend (array, (gpointer) &val, sizeof (type))
-#define g_array_prepend_vals(array,type,vals,nvals) \
- g_rarray_prepend (array, (gpointer) vals, sizeof (type) * nvals)
-#define g_array_truncate(array,type,length) \
- g_rarray_truncate (array, length, sizeof (type))
-#define g_array_index(array,type,index) \
- ((type*) array->data)[index]
-
-GArray* g_array_new (gboolean zero_terminated);
-void g_array_free (GArray *array,
- gboolean free_segment);
-GArray* g_rarray_append (GArray *array,
- gpointer data,
- gint size);
-GArray* g_rarray_prepend (GArray *array,
- gpointer data,
- gint size);
-GArray* g_rarray_truncate (GArray *array,
- gint length,
- gint size);
+#define g_array_append_val(a,v) g_array_append_vals(a,&v,1)
+#define g_array_prepend_val(a,v) g_array_prepend_vals(a,&v,1)
+#define g_array_index(a,t,i) (((t*)a->data)[i])
+
+GArray* g_array_new (gboolean zero_terminated,
+ gboolean clear,
+ guint element_size);
+void g_array_free (GArray *array,
+ gboolean free_segment);
+GArray* g_array_append_vals (GArray *array,
+ gpointer data,
+ guint len);
+GArray* g_array_prepend_vals (GArray *array,
+ gpointer data,
+ guint len);
+GArray* g_array_set_size (GArray *array,
+ guint length);
/* Resizable pointer array. This interface is much less complicated
* than the above. Add appends appends a pointer. Remove fills any
@@ -1324,30 +1314,28 @@ void g_ptr_array_free (GPtrArray *array,
gboolean free_seg);
void g_ptr_array_set_size (GPtrArray *array,
gint length);
-void g_ptr_array_remove_index (GPtrArray *array,
- gint index);
-gboolean g_ptr_array_remove (GPtrArray *array,
- gpointer data);
-void g_ptr_array_add (GPtrArray *array,
- gpointer data);
-
+gpointer g_ptr_array_remove_index (GPtrArray *array,
+ gint index);
+gboolean g_ptr_array_remove (GPtrArray *array,
+ gpointer data);
+void g_ptr_array_add (GPtrArray *array,
+ gpointer data);
/* Byte arrays, an array of guint8. Implemented as a GArray,
* but type-safe.
*/
-GByteArray* g_byte_array_new (void);
-void g_byte_array_free (GByteArray *array,
- gint free_segment);
-GByteArray* g_byte_array_append (GByteArray *array,
- const guint8 *data,
- guint len);
-GByteArray* g_byte_array_prepend (GByteArray *array,
+GByteArray* g_byte_array_new (void);
+void g_byte_array_free (GByteArray *array,
+ gboolean free_segment);
+GByteArray* g_byte_array_append (GByteArray *array,
const guint8 *data,
- guint len);
-
-GByteArray* g_byte_array_truncate (GByteArray *array,
- gint length);
+ guint len);
+GByteArray* g_byte_array_prepend (GByteArray *array,
+ const guint8 *data,
+ guint len);
+GByteArray* g_byte_array_set_size (GByteArray *array,
+ guint length);
/* Hash Functions
@@ -1437,7 +1425,7 @@ typedef enum
typedef enum
{
G_TOKEN_EOF = 0,
-
+
G_TOKEN_LEFT_PAREN = '(',
G_TOKEN_RIGHT_PAREN = ')',
G_TOKEN_LEFT_CURLY = '{',
@@ -1446,11 +1434,11 @@ typedef enum
G_TOKEN_RIGHT_BRACE = ']',
G_TOKEN_EQUAL_SIGN = '=',
G_TOKEN_COMMA = ',',
-
+
G_TOKEN_NONE = 256,
-
+
G_TOKEN_ERROR,
-
+
G_TOKEN_CHAR,
G_TOKEN_BINARY,
G_TOKEN_OCTAL,
@@ -1458,11 +1446,11 @@ typedef enum
G_TOKEN_HEX,
G_TOKEN_FLOAT,
G_TOKEN_STRING,
-
+
G_TOKEN_SYMBOL,
G_TOKEN_IDENTIFIER,
G_TOKEN_IDENTIFIER_NULL,
-
+
G_TOKEN_COMMENT_SINGLE,
G_TOKEN_COMMENT_MULTI,
G_TOKEN_LAST
@@ -1491,11 +1479,11 @@ struct _GScannerConfig
gchar *cset_identifier_first;
gchar *cset_identifier_nth;
gchar *cpair_comment_single; /* default: "#\n" */
-
+
/* Should symbol lookup work case sensitive?
*/
guint case_sensitive : 1;
-
+
/* Boolean values to be adjusted "on the fly"
* to configure scanning behaviour.
*/
@@ -1526,31 +1514,31 @@ struct _GScanner
/* unused fields */
gpointer user_data;
guint max_parse_errors;
-
+
/* g_scanner_error() increments this field */
guint parse_errors;
-
+
/* name of input stream, featured by the default message handler */
const gchar *input_name;
-
+
/* data pointer for derived structures */
gpointer derived_data;
-
+
/* link into the scanner configuration */
GScannerConfig *config;
-
+
/* fields filled in after g_scanner_get_next_token() */
GTokenType token;
GValue value;
guint line;
guint position;
-
+
/* fields filled in after g_scanner_peek_next_token() */
GTokenType next_token;
GValue next_value;
guint next_line;
guint next_position;
-
+
/* to be considered private */
GHashTable *symbol_table;
const gchar *text;
@@ -1558,7 +1546,7 @@ struct _GScanner
gint input_fd;
gint peeked_char;
guint scope_id;
-
+
/* handler function for _warn and _error */
GScannerMsgFunc msg_handler;
};
@@ -1629,18 +1617,18 @@ struct _GCompletion
{
GList* items;
GCompletionFunc func;
-
+
gchar* prefix;
GList* cache;
};
GCompletion* g_completion_new (GCompletionFunc func);
-void g_completion_add_items (GCompletion* cmp,
+void g_completion_add_items (GCompletion* cmp,
GList* items);
-void g_completion_remove_items (GCompletion* cmp,
+void g_completion_remove_items (GCompletion* cmp,
GList* items);
void g_completion_clear_items (GCompletion* cmp);
-GList* g_completion_complete (GCompletion* cmp,
+GList* g_completion_complete (GCompletion* cmp,
gchar* prefix,
gchar** new_prefix);
void g_completion_free (GCompletion* cmp);
@@ -1694,8 +1682,23 @@ gpointer g_tuples_index (GTuples *tuples,
gint field);
+/* Prime numbers.
+ */
+/* This function returns prime numbers spaced by approximately 1.5-2.0
+ * and is for use in resizing data structures which prefer
+ * prime-valued sizes. The closest spaced prime function returns the
+ * next largest prime, or the highest it knows about which is about
+ * MAXINT/4.
+ */
+guint g_spaced_primes_closest (guint num);
+
+/* Glib version.
+ */
+extern const guint glib_major_version;
+extern const guint glib_minor_version;
+extern const guint glib_micro_version;
#ifdef __cplusplus
}
diff --git a/glib/garray.c b/glib/garray.c
index 2429ab055..57cc68c30 100644
--- a/glib/garray.c
+++ b/glib/garray.c
@@ -30,7 +30,9 @@ struct _GRealArray
guint8 *data;
guint len;
guint alloc;
- guint zero_terminated;
+ guint elt_size;
+ guint zero_terminated : 1;
+ guint clear : 1;
};
@@ -43,7 +45,9 @@ static GMemChunk *array_mem_chunk = NULL;
GArray*
-g_array_new (gboolean zero_terminated)
+g_array_new (gboolean zero_terminated,
+ gboolean clear,
+ guint elt_size)
{
GRealArray *array;
@@ -54,10 +58,12 @@ g_array_new (gboolean zero_terminated)
array = g_chunk_new (GRealArray, array_mem_chunk);
- array->data = NULL;
- array->len = 0;
- array->alloc = 0;
+ array->data = NULL;
+ array->len = 0;
+ array->alloc = 0;
array->zero_terminated = (zero_terminated ? 1 : 0);
+ array->clear = (clear ? 1 : 0);
+ array->elt_size = elt_size;
return (GArray*) array;
}
@@ -73,45 +79,52 @@ g_array_free (GArray *array,
}
GArray*
-g_rarray_append (GArray *array,
- gpointer data,
- gint size)
+g_array_append_vals (GArray *farray,
+ gpointer data,
+ guint len)
{
- g_array_maybe_expand ((GRealArray*) array, size);
+ GRealArray *array = (GRealArray*) farray;
- memcpy (array->data + array->len, data, size);
+ g_array_maybe_expand (array, len);
- array->len += size;
+ memcpy (array->data + array->elt_size * array->len, data, array->elt_size * len);
- return array;
+ array->len += len;
+
+ return farray;
}
GArray*
-g_rarray_prepend (GArray *array,
- gpointer data,
- gint size)
+g_array_prepend_vals (GArray *farray,
+ gpointer data,
+ guint len)
{
- g_array_maybe_expand ((GRealArray*) array, size);
+ GRealArray *array = (GRealArray*) farray;
- g_memmove (array->data + size, array->data, array->len);
- memcpy (array->data, data, size);
+ g_array_maybe_expand (array, len);
- array->len += size;
+ g_memmove (array->data + array->elt_size * len, array->data, array->elt_size * array->len);
- return array;
+ memcpy (array->data, data, len * array->elt_size);
+
+ array->len += len;
+
+ return farray;
}
GArray*
-g_rarray_truncate (GArray *array,
- gint length,
- gint size)
+g_array_set_size (GArray *farray,
+ guint length)
{
- if (array->data)
- memset (array->data + length * size, 0, size);
- array->len = length * size;
- return array;
-}
+ GRealArray *array = (GRealArray*) farray;
+ if (array->len < length)
+ g_array_maybe_expand (array, length - array->len);
+
+ array->len = length;
+
+ return farray;
+}
static gint
g_nearest_pow (gint num)
@@ -128,17 +141,19 @@ static void
g_array_maybe_expand (GRealArray *array,
gint len)
{
- guint old_alloc;
+ guint want_alloc = (array->len + len + array->zero_terminated) * array->elt_size;
- if ((array->len + len) > array->alloc)
+ if (want_alloc > array->alloc)
{
- old_alloc = array->alloc;
+ guint old_alloc = array->alloc;
- array->alloc = g_nearest_pow (array->len + array->zero_terminated + len);
+ array->alloc = g_nearest_pow (want_alloc);
array->alloc = MAX (array->alloc, MIN_ARRAY_SIZE);
+
array->data = g_realloc (array->data, array->alloc);
- memset (array->data + old_alloc, 0, array->alloc - old_alloc);
+ if (array->clear || array->zero_terminated)
+ memset (array->data + old_alloc, 0, array->alloc - old_alloc);
}
}
@@ -228,21 +243,26 @@ g_ptr_array_set_size (GPtrArray *farray,
array->len = length;
}
-void
+gpointer
g_ptr_array_remove_index (GPtrArray* farray,
gint index)
{
GRealPtrArray* array = (GRealPtrArray*) farray;
+ gpointer result;
- g_return_if_fail (array);
+ g_return_val_if_fail (array, NULL);
- g_return_if_fail (index < array->len);
+ g_return_val_if_fail (index >= 0 && index < array->len, NULL);
+
+ result = array->pdata[index];
array->pdata[index] = array->pdata[array->len - 1];
array->pdata[array->len - 1] = NULL;
array->len -= 1;
+
+ return result;
}
gboolean
@@ -284,11 +304,11 @@ g_ptr_array_add (GPtrArray* farray,
GByteArray* g_byte_array_new (void)
{
- return (GByteArray*) g_array_new (FALSE);
+ return (GByteArray*) g_array_new (FALSE, FALSE, 1);
}
void g_byte_array_free (GByteArray *array,
- gint free_segment)
+ gboolean free_segment)
{
g_array_free ((GArray*) array, free_segment);
}
@@ -297,7 +317,7 @@ GByteArray* g_byte_array_append (GByteArray *array,
const guint8 *data,
guint len)
{
- g_rarray_append ((GArray*) array, (guint8*)data, len);
+ g_array_append_vals ((GArray*) array, (guint8*)data, len);
return array;
}
@@ -306,15 +326,15 @@ GByteArray* g_byte_array_prepend (GByteArray *array,
const guint8 *data,
guint len)
{
- g_rarray_prepend ((GArray*) array, (guint8*)data, len);
+ g_array_prepend_vals ((GArray*) array, (guint8*)data, len);
return array;
}
-GByteArray* g_byte_array_truncate (GByteArray *array,
- gint length)
+GByteArray* g_byte_array_set_size (GByteArray *array,
+ guint length)
{
- g_rarray_truncate ((GArray*) array, length, 1);
+ g_array_set_size ((GArray*) array, length);
return array;
}
diff --git a/glib/ghash.c b/glib/ghash.c
index ee1ca7f61..b2c3838dd 100644
--- a/glib/ghash.c
+++ b/glib/ghash.c
@@ -46,7 +46,6 @@ struct _GHashTable
static void g_hash_table_resize (GHashTable *hash_table);
static GHashNode** g_hash_table_lookup_node(GHashTable *hash_table,
gconstpointer key);
-static gint g_hash_closest_prime (gint num);
static GHashNode* g_hash_node_new (gpointer key,
gpointer value);
static void g_hash_node_destroy (GHashNode *hash_node);
@@ -63,7 +62,7 @@ g_hash_table_new (GHashFunc hash_func,
{
GHashTable *hash_table;
gint i;
-
+
hash_table = g_new (GHashTable, 1);
hash_table->size = HASH_TABLE_MIN_SIZE;
hash_table->nnodes = 0;
@@ -71,7 +70,7 @@ g_hash_table_new (GHashFunc hash_func,
hash_table->hash_func = hash_func ? hash_func : g_direct_hash;
hash_table->key_compare_func = key_compare_func;
hash_table->nodes = g_new (GHashNode*, hash_table->size);
-
+
for (i = 0; i < hash_table->size; i++)
hash_table->nodes[i] = NULL;
@@ -84,10 +83,10 @@ g_hash_table_destroy (GHashTable *hash_table)
gint i;
g_return_if_fail (hash_table);
-
+
for (i = 0; i < hash_table->size; i++)
g_hash_nodes_destroy (hash_table->nodes[i]);
-
+
g_free (hash_table->nodes);
g_free (hash_table);
}
@@ -100,7 +99,7 @@ g_hash_table_insert (GHashTable *hash_table,
GHashNode **node;
g_return_if_fail (hash_table);
-
+
node = g_hash_table_lookup_node (hash_table, key);
if (*node)
@@ -146,7 +145,7 @@ g_hash_table_lookup (GHashTable *hash_table,
gconstpointer key)
{
GHashNode *node;
-
+
g_return_val_if_fail (hash_table, NULL);
node = *g_hash_table_lookup_node (hash_table, key);
@@ -160,7 +159,7 @@ g_hash_table_lookup_extended (GHashTable *hash_table,
gpointer *value)
{
GHashNode *node;
-
+
g_return_val_if_fail (hash_table, FALSE);
node = *g_hash_table_lookup_node (hash_table, lookup_key);
@@ -232,19 +231,19 @@ g_hash_table_resize (GHashTable *hash_table)
g_return_if_fail (hash_table);
nodes_per_list = (gfloat) hash_table->nnodes / (gfloat) hash_table->size;
-
+
if ((nodes_per_list > 0.3 || hash_table->size <= HASH_TABLE_MIN_SIZE) &&
(nodes_per_list < 3.0 || hash_table->size >= HASH_TABLE_MAX_SIZE))
return;
- new_size = CLAMP(g_hash_closest_prime (hash_table->nnodes),
+ new_size = CLAMP(g_spaced_primes_closest (hash_table->nnodes),
HASH_TABLE_MIN_SIZE,
HASH_TABLE_MAX_SIZE);
new_nodes = g_new (GHashNode*, new_size);
-
+
for (i = 0; i < new_size; i++)
new_nodes[i] = NULL;
-
+
for (i = 0; i < hash_table->size; i++)
for (node = hash_table->nodes[i]; node; node = next)
{
@@ -253,7 +252,7 @@ g_hash_table_resize (GHashTable *hash_table)
node->next = new_nodes[hash_val];
new_nodes[hash_val] = node;
}
-
+
g_free (hash_table->nodes);
hash_table->nodes = new_nodes;
hash_table->size = new_size;
@@ -264,7 +263,7 @@ g_hash_table_lookup_node (GHashTable *hash_table,
gconstpointer key)
{
GHashNode **node;
-
+
g_return_val_if_fail (hash_table, NULL);
node = &hash_table->nodes
@@ -281,22 +280,8 @@ g_hash_table_lookup_node (GHashTable *hash_table,
else
while (*node && (*node)->key != key)
node = &(*node)->next;
-
- return node;
-}
-static gint
-g_hash_closest_prime (gint num)
-{
- extern gint g_primes[];
- extern gint g_nprimes;
- gint i;
-
- for (i = 0; i < g_nprimes; i++)
- if ((g_primes[i] - num) > 0)
- return g_primes[i];
-
- return g_primes[g_nprimes - 1];
+ return node;
}
static GHashNode*
diff --git a/glib/glib.h b/glib/glib.h
index 62ade5dcb..601153a29 100644
--- a/glib/glib.h
+++ b/glib/glib.h
@@ -241,7 +241,7 @@
# define ATEXIT(proc) (atexit (proc))
# elif defined (HAVE_ON_EXIT)
# define ATEXIT(proc) (on_exit ((void (*)(int, void *))(proc), NULL))
-# endif
+# endif
#endif /* ATEXIT */
@@ -438,9 +438,9 @@ typedef unsigned int guint;
typedef float gfloat;
typedef double gdouble;
-/* HAVE_LONG_DOUBLE doesn't work correctly on all platforms.
- * Since gldouble isn't used anywhere, just disable it for now
- */
+/* HAVE_LONG_DOUBLE doesn't work correctly on all platforms.
+ * Since gldouble isn't used anywhere, just disable it for now */
+
#if 0
#ifdef HAVE_LONG_DOUBLE
typedef long double gldouble;
@@ -575,7 +575,7 @@ typedef enum
/* log flags */
G_LOG_FLAG_RECURSION = 1 << 0,
G_LOG_FLAG_FATAL = 1 << 1,
-
+
/* GLib log levels */
G_LOG_LEVEL_ERROR = 1 << 2, /* always fatal */
G_LOG_LEVEL_CRITICAL = 1 << 3,
@@ -583,7 +583,7 @@ typedef enum
G_LOG_LEVEL_MESSAGE = 1 << 5,
G_LOG_LEVEL_INFO = 1 << 6,
G_LOG_LEVEL_DEBUG = 1 << 7,
-
+
G_LOG_LEVEL_MASK = ~(G_LOG_FLAG_RECURSION | G_LOG_FLAG_FATAL)
} GLogLevelFlags;
@@ -692,8 +692,8 @@ GList* g_list_insert (GList *list,
gint position);
GList* g_list_insert_sorted (GList *list,
gpointer data,
- GCompareFunc func);
-GList* g_list_concat (GList *list1,
+ GCompareFunc func);
+GList* g_list_concat (GList *list1,
GList *list2);
GList* g_list_remove (GList *list,
gpointer data);
@@ -737,8 +737,8 @@ GSList* g_slist_insert (GSList *list,
gint position);
GSList* g_slist_insert_sorted (GSList *list,
gpointer data,
- GCompareFunc func);
-GSList* g_slist_concat (GSList *list1,
+ GCompareFunc func);
+GSList* g_slist_concat (GSList *list1,
GSList *list2);
GSList* g_slist_remove (GSList *list,
gpointer data);
@@ -1159,8 +1159,8 @@ void g_set_prgname (const gchar *prgname);
/* Miscellaneous utility functions
*/
-guint g_parse_debug_string (const gchar *string,
- GDebugKey *keys,
+guint g_parse_debug_string (const gchar *string,
+ GDebugKey *keys,
guint nkeys);
gint g_snprintf (gchar *string,
gulong n,
@@ -1185,7 +1185,7 @@ gchar* g_get_current_dir (void);
#define g_memmove(dest, src, size) G_STMT_START { \
memmove ((dest), (src), (size)); \
} G_STMT_END
-#else
+#else
#define g_memmove(dest, src, size) G_STMT_START { \
bcopy ((src), (dest), (size)); \
} G_STMT_END
@@ -1226,7 +1226,7 @@ static inline guint
g_bit_storage (guint number)
{
register guint n_bits = 0;
-
+
do
{
n_bits++;
@@ -1264,14 +1264,14 @@ GString* g_string_prepend (GString *string,
const gchar *val);
GString* g_string_prepend_c (GString *string,
gchar c);
-GString* g_string_insert (GString *string,
- gint pos,
+GString* g_string_insert (GString *string,
+ gint pos,
const gchar *val);
-GString* g_string_insert_c (GString *string,
- gint pos,
+GString* g_string_insert_c (GString *string,
+ gint pos,
gchar c);
-GString* g_string_erase (GString *string,
- gint pos,
+GString* g_string_erase (GString *string,
+ gint pos,
gint len);
GString* g_string_down (GString *string);
GString* g_string_up (GString *string);
@@ -1285,34 +1285,24 @@ void g_string_sprintfa (GString *string,
/* Resizable arrays
*/
-#define g_array_length(array,type) \
- (((array)->len)/sizeof(type))
-#define g_array_append_val(array,type,val) \
- g_rarray_append (array, (gpointer) &val, sizeof (type))
-#define g_array_append_vals(array,type,vals,nvals) \
- g_rarray_append (array, (gpointer) vals, sizeof (type) * nvals)
-#define g_array_prepend_val(array,type,val) \
- g_rarray_prepend (array, (gpointer) &val, sizeof (type))
-#define g_array_prepend_vals(array,type,vals,nvals) \
- g_rarray_prepend (array, (gpointer) vals, sizeof (type) * nvals)
-#define g_array_truncate(array,type,length) \
- g_rarray_truncate (array, length, sizeof (type))
-#define g_array_index(array,type,index) \
- ((type*) array->data)[index]
-
-GArray* g_array_new (gboolean zero_terminated);
-void g_array_free (GArray *array,
- gboolean free_segment);
-GArray* g_rarray_append (GArray *array,
- gpointer data,
- gint size);
-GArray* g_rarray_prepend (GArray *array,
- gpointer data,
- gint size);
-GArray* g_rarray_truncate (GArray *array,
- gint length,
- gint size);
+#define g_array_append_val(a,v) g_array_append_vals(a,&v,1)
+#define g_array_prepend_val(a,v) g_array_prepend_vals(a,&v,1)
+#define g_array_index(a,t,i) (((t*)a->data)[i])
+
+GArray* g_array_new (gboolean zero_terminated,
+ gboolean clear,
+ guint element_size);
+void g_array_free (GArray *array,
+ gboolean free_segment);
+GArray* g_array_append_vals (GArray *array,
+ gpointer data,
+ guint len);
+GArray* g_array_prepend_vals (GArray *array,
+ gpointer data,
+ guint len);
+GArray* g_array_set_size (GArray *array,
+ guint length);
/* Resizable pointer array. This interface is much less complicated
* than the above. Add appends appends a pointer. Remove fills any
@@ -1324,30 +1314,28 @@ void g_ptr_array_free (GPtrArray *array,
gboolean free_seg);
void g_ptr_array_set_size (GPtrArray *array,
gint length);
-void g_ptr_array_remove_index (GPtrArray *array,
- gint index);
-gboolean g_ptr_array_remove (GPtrArray *array,
- gpointer data);
-void g_ptr_array_add (GPtrArray *array,
- gpointer data);
-
+gpointer g_ptr_array_remove_index (GPtrArray *array,
+ gint index);
+gboolean g_ptr_array_remove (GPtrArray *array,
+ gpointer data);
+void g_ptr_array_add (GPtrArray *array,
+ gpointer data);
/* Byte arrays, an array of guint8. Implemented as a GArray,
* but type-safe.
*/
-GByteArray* g_byte_array_new (void);
-void g_byte_array_free (GByteArray *array,
- gint free_segment);
-GByteArray* g_byte_array_append (GByteArray *array,
- const guint8 *data,
- guint len);
-GByteArray* g_byte_array_prepend (GByteArray *array,
+GByteArray* g_byte_array_new (void);
+void g_byte_array_free (GByteArray *array,
+ gboolean free_segment);
+GByteArray* g_byte_array_append (GByteArray *array,
const guint8 *data,
- guint len);
-
-GByteArray* g_byte_array_truncate (GByteArray *array,
- gint length);
+ guint len);
+GByteArray* g_byte_array_prepend (GByteArray *array,
+ const guint8 *data,
+ guint len);
+GByteArray* g_byte_array_set_size (GByteArray *array,
+ guint length);
/* Hash Functions
@@ -1437,7 +1425,7 @@ typedef enum
typedef enum
{
G_TOKEN_EOF = 0,
-
+
G_TOKEN_LEFT_PAREN = '(',
G_TOKEN_RIGHT_PAREN = ')',
G_TOKEN_LEFT_CURLY = '{',
@@ -1446,11 +1434,11 @@ typedef enum
G_TOKEN_RIGHT_BRACE = ']',
G_TOKEN_EQUAL_SIGN = '=',
G_TOKEN_COMMA = ',',
-
+
G_TOKEN_NONE = 256,
-
+
G_TOKEN_ERROR,
-
+
G_TOKEN_CHAR,
G_TOKEN_BINARY,
G_TOKEN_OCTAL,
@@ -1458,11 +1446,11 @@ typedef enum
G_TOKEN_HEX,
G_TOKEN_FLOAT,
G_TOKEN_STRING,
-
+
G_TOKEN_SYMBOL,
G_TOKEN_IDENTIFIER,
G_TOKEN_IDENTIFIER_NULL,
-
+
G_TOKEN_COMMENT_SINGLE,
G_TOKEN_COMMENT_MULTI,
G_TOKEN_LAST
@@ -1491,11 +1479,11 @@ struct _GScannerConfig
gchar *cset_identifier_first;
gchar *cset_identifier_nth;
gchar *cpair_comment_single; /* default: "#\n" */
-
+
/* Should symbol lookup work case sensitive?
*/
guint case_sensitive : 1;
-
+
/* Boolean values to be adjusted "on the fly"
* to configure scanning behaviour.
*/
@@ -1526,31 +1514,31 @@ struct _GScanner
/* unused fields */
gpointer user_data;
guint max_parse_errors;
-
+
/* g_scanner_error() increments this field */
guint parse_errors;
-
+
/* name of input stream, featured by the default message handler */
const gchar *input_name;
-
+
/* data pointer for derived structures */
gpointer derived_data;
-
+
/* link into the scanner configuration */
GScannerConfig *config;
-
+
/* fields filled in after g_scanner_get_next_token() */
GTokenType token;
GValue value;
guint line;
guint position;
-
+
/* fields filled in after g_scanner_peek_next_token() */
GTokenType next_token;
GValue next_value;
guint next_line;
guint next_position;
-
+
/* to be considered private */
GHashTable *symbol_table;
const gchar *text;
@@ -1558,7 +1546,7 @@ struct _GScanner
gint input_fd;
gint peeked_char;
guint scope_id;
-
+
/* handler function for _warn and _error */
GScannerMsgFunc msg_handler;
};
@@ -1629,18 +1617,18 @@ struct _GCompletion
{
GList* items;
GCompletionFunc func;
-
+
gchar* prefix;
GList* cache;
};
GCompletion* g_completion_new (GCompletionFunc func);
-void g_completion_add_items (GCompletion* cmp,
+void g_completion_add_items (GCompletion* cmp,
GList* items);
-void g_completion_remove_items (GCompletion* cmp,
+void g_completion_remove_items (GCompletion* cmp,
GList* items);
void g_completion_clear_items (GCompletion* cmp);
-GList* g_completion_complete (GCompletion* cmp,
+GList* g_completion_complete (GCompletion* cmp,
gchar* prefix,
gchar** new_prefix);
void g_completion_free (GCompletion* cmp);
@@ -1694,8 +1682,23 @@ gpointer g_tuples_index (GTuples *tuples,
gint field);
+/* Prime numbers.
+ */
+/* This function returns prime numbers spaced by approximately 1.5-2.0
+ * and is for use in resizing data structures which prefer
+ * prime-valued sizes. The closest spaced prime function returns the
+ * next largest prime, or the highest it knows about which is about
+ * MAXINT/4.
+ */
+guint g_spaced_primes_closest (guint num);
+
+/* Glib version.
+ */
+extern const guint glib_major_version;
+extern const guint glib_minor_version;
+extern const guint glib_micro_version;
#ifdef __cplusplus
}
diff --git a/glib/gprimes.c b/glib/gprimes.c
index 6a38b399d..3d45c1ef7 100644
--- a/glib/gprimes.c
+++ b/glib/gprimes.c
@@ -18,14 +18,11 @@
*/
#include "glib.h"
-
-gint g_primes[] =
+static const guint g_primes[] =
{
11,
- 15,
- 23,
- 35,
- 49,
+ 19,
+ 37,
73,
109,
163,
@@ -59,4 +56,16 @@ gint g_primes[] =
13845163,
};
-gint g_nprimes = sizeof (g_primes) / sizeof (g_primes[0]);
+static const guint g_nprimes = sizeof (g_primes) / sizeof (g_primes[0]);
+
+guint
+g_spaced_primes_closest (guint num)
+{
+ gint i;
+
+ for (i = 0; i < g_nprimes; i++)
+ if (g_primes[i] > num)
+ return g_primes[i];
+
+ return g_primes[g_nprimes - 1];
+}
diff --git a/gprimes.c b/gprimes.c
index 6a38b399d..3d45c1ef7 100644
--- a/gprimes.c
+++ b/gprimes.c
@@ -18,14 +18,11 @@
*/
#include "glib.h"
-
-gint g_primes[] =
+static const guint g_primes[] =
{
11,
- 15,
- 23,
- 35,
- 49,
+ 19,
+ 37,
73,
109,
163,
@@ -59,4 +56,16 @@ gint g_primes[] =
13845163,
};
-gint g_nprimes = sizeof (g_primes) / sizeof (g_primes[0]);
+static const guint g_nprimes = sizeof (g_primes) / sizeof (g_primes[0]);
+
+guint
+g_spaced_primes_closest (guint num)
+{
+ gint i;
+
+ for (i = 0; i < g_nprimes; i++)
+ if (g_primes[i] > num)
+ return g_primes[i];
+
+ return g_primes[g_nprimes - 1];
+}
diff --git a/testglib.c b/testglib.c
index c196a2c0f..01b6366ba 100644
--- a/testglib.c
+++ b/testglib.c
@@ -199,7 +199,7 @@ my_hash_compare (gconstpointer a,
return *((const gint*) a) == *((const gint*) b);
}
-gint
+gint
my_list_compare_one (gconstpointer a, gconstpointer b)
{
gint one = *((const gint*)a);
@@ -207,7 +207,7 @@ my_list_compare_one (gconstpointer a, gconstpointer b)
return one-two;
}
-gint
+gint
my_list_compare_two (gconstpointer a, gconstpointer b)
{
gint one = *((const gint*)a);
@@ -348,7 +348,7 @@ main (int argc,
g_list_free (list);
list = NULL;
-
+
for (i = 0; i < 10; i++)
list = g_list_insert_sorted (list, &morenums[i], my_list_compare_one);
@@ -363,10 +363,10 @@ main (int argc,
if (*((gint*) t->data) != i)
g_error ("Sorted insert failed");
}
-
+
g_list_free (list);
list = NULL;
-
+
for (i = 0; i < 10; i++)
list = g_list_insert_sorted (list, &morenums[i], my_list_compare_two);
@@ -381,7 +381,7 @@ main (int argc,
if (*((gint*) t->data) != (9 - i))
g_error ("Sorted insert failed");
}
-
+
g_list_free (list);
g_print ("ok\n");
@@ -418,10 +418,10 @@ main (int argc,
if (*((gint*) st->data) != i)
g_error ("Sorted insert failed");
}
-
+
g_slist_free(slist);
slist = NULL;
-
+
for (i = 0; i < 10; i++)
slist = g_slist_insert_sorted (slist, &morenums[i], my_list_compare_two);
@@ -436,7 +436,7 @@ main (int argc,
if (*((gint*) st->data) != (9 - i))
g_error("Sorted insert failed");
}
-
+
g_slist_free(slist);
g_print ("ok\n");
@@ -555,9 +555,9 @@ main (int argc,
g_print ("checking arrays...");
- garray = g_array_new (FALSE);
+ garray = g_array_new (FALSE, FALSE, sizeof (gint));
for (i = 0; i < 10000; i++)
- g_array_append_val (garray, gint, i);
+ g_array_append_val (garray, i);
for (i = 0; i < 10000; i++)
if (g_array_index (garray, gint, i) != i)
@@ -565,13 +565,13 @@ main (int argc,
g_array_free (garray, TRUE);
- garray = g_array_new (FALSE);
- for (i = 0; i < 10000; i++)
- g_array_prepend_val (garray, gint, i);
+ garray = g_array_new (FALSE, FALSE, sizeof (gint));
+ for (i = 0; i < 100; i++)
+ g_array_prepend_val (garray, i);
- for (i = 0; i < 10000; i++)
- if (g_array_index (garray, gint, i) != (10000 - i - 1))
- g_print ("uh oh: %d ( %d )\n", g_array_index (garray, gint, i), 10000 - i - 1);
+ for (i = 0; i < 100; i++)
+ if (g_array_index (garray, gint, i) != (100 - i - 1))
+ g_print ("uh oh: %d ( %d )\n", g_array_index (garray, gint, i), 100 - i - 1);
g_array_free (garray, TRUE);
diff --git a/tests/testglib.c b/tests/testglib.c
index c196a2c0f..01b6366ba 100644
--- a/tests/testglib.c
+++ b/tests/testglib.c
@@ -199,7 +199,7 @@ my_hash_compare (gconstpointer a,
return *((const gint*) a) == *((const gint*) b);
}
-gint
+gint
my_list_compare_one (gconstpointer a, gconstpointer b)
{
gint one = *((const gint*)a);
@@ -207,7 +207,7 @@ my_list_compare_one (gconstpointer a, gconstpointer b)
return one-two;
}
-gint
+gint
my_list_compare_two (gconstpointer a, gconstpointer b)
{
gint one = *((const gint*)a);
@@ -348,7 +348,7 @@ main (int argc,
g_list_free (list);
list = NULL;
-
+
for (i = 0; i < 10; i++)
list = g_list_insert_sorted (list, &morenums[i], my_list_compare_one);
@@ -363,10 +363,10 @@ main (int argc,
if (*((gint*) t->data) != i)
g_error ("Sorted insert failed");
}
-
+
g_list_free (list);
list = NULL;
-
+
for (i = 0; i < 10; i++)
list = g_list_insert_sorted (list, &morenums[i], my_list_compare_two);
@@ -381,7 +381,7 @@ main (int argc,
if (*((gint*) t->data) != (9 - i))
g_error ("Sorted insert failed");
}
-
+
g_list_free (list);
g_print ("ok\n");
@@ -418,10 +418,10 @@ main (int argc,
if (*((gint*) st->data) != i)
g_error ("Sorted insert failed");
}
-
+
g_slist_free(slist);
slist = NULL;
-
+
for (i = 0; i < 10; i++)
slist = g_slist_insert_sorted (slist, &morenums[i], my_list_compare_two);
@@ -436,7 +436,7 @@ main (int argc,
if (*((gint*) st->data) != (9 - i))
g_error("Sorted insert failed");
}
-
+
g_slist_free(slist);
g_print ("ok\n");
@@ -555,9 +555,9 @@ main (int argc,
g_print ("checking arrays...");
- garray = g_array_new (FALSE);
+ garray = g_array_new (FALSE, FALSE, sizeof (gint));
for (i = 0; i < 10000; i++)
- g_array_append_val (garray, gint, i);
+ g_array_append_val (garray, i);
for (i = 0; i < 10000; i++)
if (g_array_index (garray, gint, i) != i)
@@ -565,13 +565,13 @@ main (int argc,
g_array_free (garray, TRUE);
- garray = g_array_new (FALSE);
- for (i = 0; i < 10000; i++)
- g_array_prepend_val (garray, gint, i);
+ garray = g_array_new (FALSE, FALSE, sizeof (gint));
+ for (i = 0; i < 100; i++)
+ g_array_prepend_val (garray, i);
- for (i = 0; i < 10000; i++)
- if (g_array_index (garray, gint, i) != (10000 - i - 1))
- g_print ("uh oh: %d ( %d )\n", g_array_index (garray, gint, i), 10000 - i - 1);
+ for (i = 0; i < 100; i++)
+ if (g_array_index (garray, gint, i) != (100 - i - 1))
+ g_print ("uh oh: %d ( %d )\n", g_array_index (garray, gint, i), 100 - i - 1);
g_array_free (garray, TRUE);