+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:
* 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
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
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().
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.
* 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
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,
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().
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>
[ 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'.
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>
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>
* 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.
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>
* 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 -
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]()
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
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.
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).
* 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
+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:
* 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
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
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().
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.
* 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
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,
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().
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>
[ 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'.
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>
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>
* 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.
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>
* 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 -
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]()
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
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.
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).
* 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
+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:
* 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
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
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().
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.
* 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
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,
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().
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>
[ 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'.
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>
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>
* 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.
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>
* 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 -
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]()
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
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.
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).
* 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
+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:
* 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
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
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().
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.
* 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
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,
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().
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>
[ 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'.
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>
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>
* 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.
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>
* 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 -
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]()
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
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.
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).
* 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
+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:
* 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
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
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().
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.
* 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
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,
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().
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>
[ 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'.
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>
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>
* 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.
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>
* 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 -
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]()
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
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.
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).
* 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
+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:
* 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
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
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().
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.
* 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
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,
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().
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>
[ 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'.
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>
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>
* 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.
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>
* 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 -
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]()
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
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.
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).
* 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
+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:
* 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
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
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().
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.
* 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
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,
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().
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>
[ 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'.
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>
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>
* 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.
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>
* 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 -
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]()
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
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.
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).
* 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
+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:
* 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
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
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().
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.
* 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
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,
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().
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>
[ 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'.
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>
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>
* 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.
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>
* 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 -
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]()
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
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.
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).
* 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
guint8 *data;
guint len;
guint alloc;
- guint zero_terminated;
+ guint elt_size;
+ guint zero_terminated : 1;
+ guint clear : 1;
};
GArray*
-g_array_new (gboolean zero_terminated)
+g_array_new (gboolean zero_terminated,
+ gboolean clear,
+ guint elt_size)
{
GRealArray *array;
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;
}
}
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)
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);
}
}
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
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);
}
const guint8 *data,
guint len)
{
- g_rarray_append ((GArray*) array, (guint8*)data, len);
+ g_array_append_vals ((GArray*) array, (guint8*)data, len);
return 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;
}
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);
{
GHashTable *hash_table;
gint i;
-
+
hash_table = g_new (GHashTable, 1);
hash_table->size = HASH_TABLE_MIN_SIZE;
hash_table->nnodes = 0;
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;
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);
}
GHashNode **node;
g_return_if_fail (hash_table);
-
+
node = g_hash_table_lookup_node (hash_table, key);
if (*node)
gconstpointer key)
{
GHashNode *node;
-
+
g_return_val_if_fail (hash_table, NULL);
node = *g_hash_table_lookup_node (hash_table, key);
gpointer *value)
{
GHashNode *node;
-
+
g_return_val_if_fail (hash_table, FALSE);
node = *g_hash_table_lookup_node (hash_table, lookup_key);
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)
{
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;
gconstpointer key)
{
GHashNode **node;
-
+
g_return_val_if_fail (hash_table, NULL);
node = &hash_table->nodes
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*
# define ATEXIT(proc) (atexit (proc))
# elif defined (HAVE_ON_EXIT)
# define ATEXIT(proc) (on_exit ((void (*)(int, void *))(proc), NULL))
-# endif
+# endif
#endif /* ATEXIT */
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;
/* 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,
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;
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);
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);
/* 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,
#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
g_bit_storage (guint number)
{
register guint n_bits = 0;
-
+
do
{
n_bits++;
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);
/* 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
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
typedef enum
{
G_TOKEN_EOF = 0,
-
+
G_TOKEN_LEFT_PAREN = '(',
G_TOKEN_RIGHT_PAREN = ')',
G_TOKEN_LEFT_CURLY = '{',
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,
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
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.
*/
/* 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;
gint input_fd;
gint peeked_char;
guint scope_id;
-
+
/* handler function for _warn and _error */
GScannerMsgFunc msg_handler;
};
{
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);
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
}
guint8 *data;
guint len;
guint alloc;
- guint zero_terminated;
+ guint elt_size;
+ guint zero_terminated : 1;
+ guint clear : 1;
};
GArray*
-g_array_new (gboolean zero_terminated)
+g_array_new (gboolean zero_terminated,
+ gboolean clear,
+ guint elt_size)
{
GRealArray *array;
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;
}
}
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)
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);
}
}
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
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);
}
const guint8 *data,
guint len)
{
- g_rarray_append ((GArray*) array, (guint8*)data, len);
+ g_array_append_vals ((GArray*) array, (guint8*)data, len);
return 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;
}
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);
{
GHashTable *hash_table;
gint i;
-
+
hash_table = g_new (GHashTable, 1);
hash_table->size = HASH_TABLE_MIN_SIZE;
hash_table->nnodes = 0;
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;
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);
}
GHashNode **node;
g_return_if_fail (hash_table);
-
+
node = g_hash_table_lookup_node (hash_table, key);
if (*node)
gconstpointer key)
{
GHashNode *node;
-
+
g_return_val_if_fail (hash_table, NULL);
node = *g_hash_table_lookup_node (hash_table, key);
gpointer *value)
{
GHashNode *node;
-
+
g_return_val_if_fail (hash_table, FALSE);
node = *g_hash_table_lookup_node (hash_table, lookup_key);
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)
{
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;
gconstpointer key)
{
GHashNode **node;
-
+
g_return_val_if_fail (hash_table, NULL);
node = &hash_table->nodes
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*
# define ATEXIT(proc) (atexit (proc))
# elif defined (HAVE_ON_EXIT)
# define ATEXIT(proc) (on_exit ((void (*)(int, void *))(proc), NULL))
-# endif
+# endif
#endif /* ATEXIT */
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;
/* 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,
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;
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);
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);
/* 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,
#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
g_bit_storage (guint number)
{
register guint n_bits = 0;
-
+
do
{
n_bits++;
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);
/* 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
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
typedef enum
{
G_TOKEN_EOF = 0,
-
+
G_TOKEN_LEFT_PAREN = '(',
G_TOKEN_RIGHT_PAREN = ')',
G_TOKEN_LEFT_CURLY = '{',
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,
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
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.
*/
/* 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;
gint input_fd;
gint peeked_char;
guint scope_id;
-
+
/* handler function for _warn and _error */
GScannerMsgFunc msg_handler;
};
{
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);
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
}
*/
#include "glib.h"
-
-gint g_primes[] =
+static const guint g_primes[] =
{
11,
- 15,
- 23,
- 35,
- 49,
+ 19,
+ 37,
73,
109,
163,
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];
+}
*/
#include "glib.h"
-
-gint g_primes[] =
+static const guint g_primes[] =
{
11,
- 15,
- 23,
- 35,
- 49,
+ 19,
+ 37,
73,
109,
163,
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];
+}
return *((const gint*) a) == *((const gint*) b);
}
-gint
+gint
my_list_compare_one (gconstpointer a, gconstpointer b)
{
gint one = *((const gint*)a);
return one-two;
}
-gint
+gint
my_list_compare_two (gconstpointer a, gconstpointer b)
{
gint one = *((const gint*)a);
g_list_free (list);
list = NULL;
-
+
for (i = 0; i < 10; i++)
list = g_list_insert_sorted (list, &morenums[i], my_list_compare_one);
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);
if (*((gint*) t->data) != (9 - i))
g_error ("Sorted insert failed");
}
-
+
g_list_free (list);
g_print ("ok\n");
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);
if (*((gint*) st->data) != (9 - i))
g_error("Sorted insert failed");
}
-
+
g_slist_free(slist);
g_print ("ok\n");
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)
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);
return *((const gint*) a) == *((const gint*) b);
}
-gint
+gint
my_list_compare_one (gconstpointer a, gconstpointer b)
{
gint one = *((const gint*)a);
return one-two;
}
-gint
+gint
my_list_compare_two (gconstpointer a, gconstpointer b)
{
gint one = *((const gint*)a);
g_list_free (list);
list = NULL;
-
+
for (i = 0; i < 10; i++)
list = g_list_insert_sorted (list, &morenums[i], my_list_compare_one);
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);
if (*((gint*) t->data) != (9 - i))
g_error ("Sorted insert failed");
}
-
+
g_list_free (list);
g_print ("ok\n");
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);
if (*((gint*) st->data) != (9 - i))
g_error("Sorted insert failed");
}
-
+
g_slist_free(slist);
g_print ("ok\n");
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)
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);