From: Tim Janik Date: Fri, 12 May 2000 15:23:16 +0000 (+0000) Subject: added gobject X-Git-Tag: GLIB_1_3_1~39 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1df2ec98cbdc4789418f9652c9c90855c86b9dad;p=platform%2Fupstream%2Fglib.git added gobject Fri Apr 28 23:54:35 2000 Tim Janik * setup things for a new sub-library libgobject: * Makefile.am (SUBDIRS): added gobject * glib-config.in: feature -lgobject. * configure.in (AC_OUTPUT): generate gobject/Makefile. * glib.m4 (AM_PATH_GLIB): feature gobject module. * glib.spec.in: added %{prefix}/lib/libgobject-1.3.so.* Fri Apr 28 21:41:49 2000 Tim Janik * glib.h: added G_STRLOC macro. G_STRUCT_OFFSET(): signedness corrections. (G_CSET_DIGITS): list 0-9. * gscanner.c (g_scanner_config_template): use G_CSET_DIGITS. * glib.h: * gstrfuncs.c: (g_strdown): (g_strup): (g_strreverse): return the modified string instead of void, so calls to these functions can be nested. (g_strcanon): new function, canonicalizes string according to a given character set. Fri Apr 28 19:45:16 2000 Tim Janik * gasyncqueue.c (g_async_queue_unref): get rid of an unused variable. --- diff --git a/ChangeLog b/ChangeLog index e4013a0..01757c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +Thu May 4 02:04:46 2000 Tim Janik + + * configure.in (STRIP_DUMMY): some Make 3.79 $(strip ) versions are + broken and require an empty arg, give it to them. + +Fri Apr 28 23:54:35 2000 Tim Janik + + * setup things for a new sub-library libgobject: + + * Makefile.am (SUBDIRS): added gobject + + * glib-config.in: feature -lgobject. + + * configure.in (AC_OUTPUT): generate gobject/Makefile. + + * glib.m4 (AM_PATH_GLIB): feature gobject module. + + * glib.spec.in: added %{prefix}/lib/libgobject-1.3.so.* + +Fri Apr 28 21:41:49 2000 Tim Janik + + * glib.h: added G_STRLOC macro. + G_STRUCT_OFFSET(): signedness corrections. + (G_CSET_DIGITS): list 0-9. + * gscanner.c (g_scanner_config_template): use G_CSET_DIGITS. + + * glib.h: + * gstrfuncs.c: + (g_strdown): + (g_strup): + (g_strreverse): return the modified string instead of void, so + calls to these functions can be nested. + (g_strcanon): new function, canonicalizes string according to + a given character set. + +Fri Apr 28 19:45:16 2000 Tim Janik + + * gasyncqueue.c (g_async_queue_unref): get rid of an unused variable. + Wed May 10 19:52:44 2000 Owen Taylor * glib.m4: Print found version when test succeeds. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index e4013a0..01757c6 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,42 @@ +Thu May 4 02:04:46 2000 Tim Janik + + * configure.in (STRIP_DUMMY): some Make 3.79 $(strip ) versions are + broken and require an empty arg, give it to them. + +Fri Apr 28 23:54:35 2000 Tim Janik + + * setup things for a new sub-library libgobject: + + * Makefile.am (SUBDIRS): added gobject + + * glib-config.in: feature -lgobject. + + * configure.in (AC_OUTPUT): generate gobject/Makefile. + + * glib.m4 (AM_PATH_GLIB): feature gobject module. + + * glib.spec.in: added %{prefix}/lib/libgobject-1.3.so.* + +Fri Apr 28 21:41:49 2000 Tim Janik + + * glib.h: added G_STRLOC macro. + G_STRUCT_OFFSET(): signedness corrections. + (G_CSET_DIGITS): list 0-9. + * gscanner.c (g_scanner_config_template): use G_CSET_DIGITS. + + * glib.h: + * gstrfuncs.c: + (g_strdown): + (g_strup): + (g_strreverse): return the modified string instead of void, so + calls to these functions can be nested. + (g_strcanon): new function, canonicalizes string according to + a given character set. + +Fri Apr 28 19:45:16 2000 Tim Janik + + * gasyncqueue.c (g_async_queue_unref): get rid of an unused variable. + Wed May 10 19:52:44 2000 Owen Taylor * glib.m4: Print found version when test succeeds. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e4013a0..01757c6 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,42 @@ +Thu May 4 02:04:46 2000 Tim Janik + + * configure.in (STRIP_DUMMY): some Make 3.79 $(strip ) versions are + broken and require an empty arg, give it to them. + +Fri Apr 28 23:54:35 2000 Tim Janik + + * setup things for a new sub-library libgobject: + + * Makefile.am (SUBDIRS): added gobject + + * glib-config.in: feature -lgobject. + + * configure.in (AC_OUTPUT): generate gobject/Makefile. + + * glib.m4 (AM_PATH_GLIB): feature gobject module. + + * glib.spec.in: added %{prefix}/lib/libgobject-1.3.so.* + +Fri Apr 28 21:41:49 2000 Tim Janik + + * glib.h: added G_STRLOC macro. + G_STRUCT_OFFSET(): signedness corrections. + (G_CSET_DIGITS): list 0-9. + * gscanner.c (g_scanner_config_template): use G_CSET_DIGITS. + + * glib.h: + * gstrfuncs.c: + (g_strdown): + (g_strup): + (g_strreverse): return the modified string instead of void, so + calls to these functions can be nested. + (g_strcanon): new function, canonicalizes string according to + a given character set. + +Fri Apr 28 19:45:16 2000 Tim Janik + + * gasyncqueue.c (g_async_queue_unref): get rid of an unused variable. + Wed May 10 19:52:44 2000 Owen Taylor * glib.m4: Print found version when test succeeds. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index e4013a0..01757c6 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,42 @@ +Thu May 4 02:04:46 2000 Tim Janik + + * configure.in (STRIP_DUMMY): some Make 3.79 $(strip ) versions are + broken and require an empty arg, give it to them. + +Fri Apr 28 23:54:35 2000 Tim Janik + + * setup things for a new sub-library libgobject: + + * Makefile.am (SUBDIRS): added gobject + + * glib-config.in: feature -lgobject. + + * configure.in (AC_OUTPUT): generate gobject/Makefile. + + * glib.m4 (AM_PATH_GLIB): feature gobject module. + + * glib.spec.in: added %{prefix}/lib/libgobject-1.3.so.* + +Fri Apr 28 21:41:49 2000 Tim Janik + + * glib.h: added G_STRLOC macro. + G_STRUCT_OFFSET(): signedness corrections. + (G_CSET_DIGITS): list 0-9. + * gscanner.c (g_scanner_config_template): use G_CSET_DIGITS. + + * glib.h: + * gstrfuncs.c: + (g_strdown): + (g_strup): + (g_strreverse): return the modified string instead of void, so + calls to these functions can be nested. + (g_strcanon): new function, canonicalizes string according to + a given character set. + +Fri Apr 28 19:45:16 2000 Tim Janik + + * gasyncqueue.c (g_async_queue_unref): get rid of an unused variable. + Wed May 10 19:52:44 2000 Owen Taylor * glib.m4: Print found version when test succeeds. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index e4013a0..01757c6 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,42 @@ +Thu May 4 02:04:46 2000 Tim Janik + + * configure.in (STRIP_DUMMY): some Make 3.79 $(strip ) versions are + broken and require an empty arg, give it to them. + +Fri Apr 28 23:54:35 2000 Tim Janik + + * setup things for a new sub-library libgobject: + + * Makefile.am (SUBDIRS): added gobject + + * glib-config.in: feature -lgobject. + + * configure.in (AC_OUTPUT): generate gobject/Makefile. + + * glib.m4 (AM_PATH_GLIB): feature gobject module. + + * glib.spec.in: added %{prefix}/lib/libgobject-1.3.so.* + +Fri Apr 28 21:41:49 2000 Tim Janik + + * glib.h: added G_STRLOC macro. + G_STRUCT_OFFSET(): signedness corrections. + (G_CSET_DIGITS): list 0-9. + * gscanner.c (g_scanner_config_template): use G_CSET_DIGITS. + + * glib.h: + * gstrfuncs.c: + (g_strdown): + (g_strup): + (g_strreverse): return the modified string instead of void, so + calls to these functions can be nested. + (g_strcanon): new function, canonicalizes string according to + a given character set. + +Fri Apr 28 19:45:16 2000 Tim Janik + + * gasyncqueue.c (g_async_queue_unref): get rid of an unused variable. + Wed May 10 19:52:44 2000 Owen Taylor * glib.m4: Print found version when test succeeds. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e4013a0..01757c6 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,42 @@ +Thu May 4 02:04:46 2000 Tim Janik + + * configure.in (STRIP_DUMMY): some Make 3.79 $(strip ) versions are + broken and require an empty arg, give it to them. + +Fri Apr 28 23:54:35 2000 Tim Janik + + * setup things for a new sub-library libgobject: + + * Makefile.am (SUBDIRS): added gobject + + * glib-config.in: feature -lgobject. + + * configure.in (AC_OUTPUT): generate gobject/Makefile. + + * glib.m4 (AM_PATH_GLIB): feature gobject module. + + * glib.spec.in: added %{prefix}/lib/libgobject-1.3.so.* + +Fri Apr 28 21:41:49 2000 Tim Janik + + * glib.h: added G_STRLOC macro. + G_STRUCT_OFFSET(): signedness corrections. + (G_CSET_DIGITS): list 0-9. + * gscanner.c (g_scanner_config_template): use G_CSET_DIGITS. + + * glib.h: + * gstrfuncs.c: + (g_strdown): + (g_strup): + (g_strreverse): return the modified string instead of void, so + calls to these functions can be nested. + (g_strcanon): new function, canonicalizes string according to + a given character set. + +Fri Apr 28 19:45:16 2000 Tim Janik + + * gasyncqueue.c (g_async_queue_unref): get rid of an unused variable. + Wed May 10 19:52:44 2000 Owen Taylor * glib.m4: Print found version when test succeeds. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e4013a0..01757c6 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,42 @@ +Thu May 4 02:04:46 2000 Tim Janik + + * configure.in (STRIP_DUMMY): some Make 3.79 $(strip ) versions are + broken and require an empty arg, give it to them. + +Fri Apr 28 23:54:35 2000 Tim Janik + + * setup things for a new sub-library libgobject: + + * Makefile.am (SUBDIRS): added gobject + + * glib-config.in: feature -lgobject. + + * configure.in (AC_OUTPUT): generate gobject/Makefile. + + * glib.m4 (AM_PATH_GLIB): feature gobject module. + + * glib.spec.in: added %{prefix}/lib/libgobject-1.3.so.* + +Fri Apr 28 21:41:49 2000 Tim Janik + + * glib.h: added G_STRLOC macro. + G_STRUCT_OFFSET(): signedness corrections. + (G_CSET_DIGITS): list 0-9. + * gscanner.c (g_scanner_config_template): use G_CSET_DIGITS. + + * glib.h: + * gstrfuncs.c: + (g_strdown): + (g_strup): + (g_strreverse): return the modified string instead of void, so + calls to these functions can be nested. + (g_strcanon): new function, canonicalizes string according to + a given character set. + +Fri Apr 28 19:45:16 2000 Tim Janik + + * gasyncqueue.c (g_async_queue_unref): get rid of an unused variable. + Wed May 10 19:52:44 2000 Owen Taylor * glib.m4: Print found version when test succeeds. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e4013a0..01757c6 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,42 @@ +Thu May 4 02:04:46 2000 Tim Janik + + * configure.in (STRIP_DUMMY): some Make 3.79 $(strip ) versions are + broken and require an empty arg, give it to them. + +Fri Apr 28 23:54:35 2000 Tim Janik + + * setup things for a new sub-library libgobject: + + * Makefile.am (SUBDIRS): added gobject + + * glib-config.in: feature -lgobject. + + * configure.in (AC_OUTPUT): generate gobject/Makefile. + + * glib.m4 (AM_PATH_GLIB): feature gobject module. + + * glib.spec.in: added %{prefix}/lib/libgobject-1.3.so.* + +Fri Apr 28 21:41:49 2000 Tim Janik + + * glib.h: added G_STRLOC macro. + G_STRUCT_OFFSET(): signedness corrections. + (G_CSET_DIGITS): list 0-9. + * gscanner.c (g_scanner_config_template): use G_CSET_DIGITS. + + * glib.h: + * gstrfuncs.c: + (g_strdown): + (g_strup): + (g_strreverse): return the modified string instead of void, so + calls to these functions can be nested. + (g_strcanon): new function, canonicalizes string according to + a given character set. + +Fri Apr 28 19:45:16 2000 Tim Janik + + * gasyncqueue.c (g_async_queue_unref): get rid of an unused variable. + Wed May 10 19:52:44 2000 Owen Taylor * glib.m4: Print found version when test succeeds. diff --git a/Makefile.am b/Makefile.am index 95221d5..f66c3a2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = 1.4 -SUBDIRS = . gmodule gthread docs tests +SUBDIRS = . gobject gmodule gthread docs tests bin_SCRIPTS=glib-config BUILT_SOURCES=glib-config @@ -64,8 +64,7 @@ libglib_la_SOURCES = \ gtree.c \ gutils.c -include_HEADERS = \ - glib.h +include_HEADERS = glib.h glib-object.h configexecincludedir = $(pkglibdir)/include #configexecinclude_DATA = glibconfig.h diff --git a/configure.in b/configure.in index 39f205f..2c5af75 100644 --- a/configure.in +++ b/configure.in @@ -19,7 +19,7 @@ dnl we need to AC_DIVERT_PUSH/AC_DIVERT_POP these variable definitions so they dnl are available for $ac_help expansion (don't we all *love* autoconf?) AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl # -# The following version number definitions apply to GLib, GModule and GThread +# The following version number definitions apply to GLib, GModule, GObject and GThread # as a whole, so if changes occoured in any of them, they are all # treated with the same interface and binary age. # @@ -305,7 +305,7 @@ esac # check for bytesex stuff AC_C_BIGENDIAN -# xhexk for header files +# check for header files AC_CHECK_HEADERS(float.h, AC_DEFINE(HAVE_FLOAT_H)) AC_CHECK_HEADERS(limits.h, AC_DEFINE(HAVE_LIMITS_H)) AC_CHECK_HEADERS(pwd.h, AC_DEFINE(HAVE_PWD_H)) @@ -318,6 +318,21 @@ AC_CHECK_HEADERS(unistd.h, AC_DEFINE(HAVE_UNISTD_H)) AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H)) AC_CHECK_HEADERS(stdint.h, AC_DEFINE(HAVE_VALUES_H)) +AC_MSG_CHECKING(whether make is GNU Make) +STRIP_BEGIN= +STRIP_END= +if $ac_make --version 2>/dev/null | grep '^GNU Make ' >/dev/null ; then + STRIP_BEGIN='$(strip $(STRIP_DUMMY)' + STRIP_END=')' + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +STRIP_DUMMY= +AC_SUBST(STRIP_DUMMY) +AC_SUBST(STRIP_BEGIN) +AC_SUBST(STRIP_END) + # check additional type sizes size_includes=[" #include @@ -1503,6 +1518,7 @@ Makefile glib-config gmodule/gmoduleconf.h gmodule/Makefile +gobject/Makefile gthread/Makefile docs/Makefile docs/glib-config.1 diff --git a/gasyncqueue.c b/gasyncqueue.c index 470d2a7..16ef211 100644 --- a/gasyncqueue.c +++ b/gasyncqueue.c @@ -92,8 +92,6 @@ g_async_queue_unref_and_unlock (GAsyncQueue *queue) void g_async_queue_unref (GAsyncQueue *queue) { - gboolean stop; - g_return_if_fail (queue); g_return_if_fail (queue->ref_count > 0); diff --git a/glib-config.in b/glib-config.in index c36b667..de07f5d 100644 --- a/glib-config.in +++ b/glib-config.in @@ -17,6 +17,7 @@ Options: Libraries: glib gmodule + gobject gthread EOF exit $1 @@ -70,6 +71,9 @@ while test $# -gt 0; do gmodule) lib_gmodule=yes ;; + gobject) + lib_gobject=yes + ;; gthread) lib_gthread=yes ;; @@ -99,6 +103,9 @@ if test "$echo_libs" = "yes"; then if test "$lib_glib" = "yes"; then libsp="$libsp -lglib" fi + if test "$lib_gobject" = "yes"; then + libsp="-lgobject $libsp" + fi if test "$lib_gthread" = "yes"; then libsp="-lgthread $libsp" libsa="$libsa @G_THREAD_LIBS@" diff --git a/glib.h b/glib.h index 799a07a..b05f2bf 100644 --- a/glib.h +++ b/glib.h @@ -147,6 +147,14 @@ extern "C" { #define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string) #define G_STRINGIFY_ARG(contents) #contents +/* provide a string identifying the current code position */ +#ifdef __GNUC__ +# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()" +#else +# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) +#endif + + /* Count the number of elements in an array. The array must be defined * as such; using this with a dynamically allocated array will give * incorrect results. @@ -171,9 +179,9 @@ extern "C" { * fields through their offsets. */ #define G_STRUCT_OFFSET(struct_type, member) \ - ((gulong) ((gchar*) &((struct_type*) 0)->member)) + ((glong) ((guint8*) &((struct_type*) 0)->member)) #define G_STRUCT_MEMBER_P(struct_p, struct_offset) \ - ((gpointer) ((gchar*) (struct_p) + (gulong) (struct_offset))) + ((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset))) #define G_STRUCT_MEMBER(member_type, struct_p, struct_offset) \ (*(member_type*) G_STRUCT_MEMBER_P ((struct_p), (struct_offset))) @@ -1022,6 +1030,9 @@ GSList* g_slist_insert (GSList *list, GSList* g_slist_insert_sorted (GSList *list, gpointer data, GCompareFunc func); +GSList* g_slist_insert_before (GSList *slist, + GSList *sibling, + gpointer data); GSList* g_slist_concat (GSList *list1, GSList *list2); GSList* g_slist_remove (GSList *list, @@ -1567,6 +1578,9 @@ void g_usleep (gulong microseconds); gchar* g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter); +gchar* g_strcanon (gchar *string, + const gchar *valid_chars, + gchar subsitutor); gdouble g_strtod (const gchar *nptr, gchar **endptr); gchar* g_strerror (gint errnum); @@ -1576,9 +1590,9 @@ gint g_strcasecmp (const gchar *s1, gint g_strncasecmp (const gchar *s1, const gchar *s2, guint n); -void g_strdown (gchar *string); -void g_strup (gchar *string); -void g_strreverse (gchar *string); +gchar* g_strdown (gchar *string); +gchar* g_strup (gchar *string); +gchar* g_strreverse (gchar *string); /* removes leading spaces */ gchar* g_strchug (gchar *string); /* removes trailing spaces */ @@ -2054,6 +2068,7 @@ void g_dataset_foreach (gconstpointer dataset_location, /* Character sets */ #define G_CSET_A_2_Z "ABCDEFGHIJKLMNOPQRSTUVWXYZ" #define G_CSET_a_2_z "abcdefghijklmnopqrstuvwxyz" +#define G_CSET_DIGITS "0123456789" #define G_CSET_LATINC "\300\301\302\303\304\305\306"\ "\307\310\311\312\313\314\315\316\317\320"\ "\321\322\323\324\325\326"\ diff --git a/glib.m4 b/glib.m4 index e268fc4..0f0829a 100644 --- a/glib.m4 +++ b/glib.m4 @@ -35,6 +35,9 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and ru gmodule) glib_config_args="$glib_config_args gmodule" ;; + gobject) + glib_config_args="$glib_config_args gobject" + ;; gthread) glib_config_args="$glib_config_args gthread" ;; diff --git a/glib.spec.in b/glib.spec.in index d4ef165..67e865d 100644 --- a/glib.spec.in +++ b/glib.spec.in @@ -80,6 +80,7 @@ rm -rf $RPM_BUILD_ROOT %{prefix}/lib/libglib-1.3.so.* %{prefix}/lib/libgthread-1.3.so.* %{prefix}/lib/libgmodule-1.3.so.* +%{prefix}/lib/libgobject-1.3.so.* %files devel %defattr(-, root, root) diff --git a/glib/Makefile.am b/glib/Makefile.am index 95221d5..f66c3a2 100644 --- a/glib/Makefile.am +++ b/glib/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = 1.4 -SUBDIRS = . gmodule gthread docs tests +SUBDIRS = . gobject gmodule gthread docs tests bin_SCRIPTS=glib-config BUILT_SOURCES=glib-config @@ -64,8 +64,7 @@ libglib_la_SOURCES = \ gtree.c \ gutils.c -include_HEADERS = \ - glib.h +include_HEADERS = glib.h glib-object.h configexecincludedir = $(pkglibdir)/include #configexecinclude_DATA = glibconfig.h diff --git a/glib/gasyncqueue.c b/glib/gasyncqueue.c index 470d2a7..16ef211 100644 --- a/glib/gasyncqueue.c +++ b/glib/gasyncqueue.c @@ -92,8 +92,6 @@ g_async_queue_unref_and_unlock (GAsyncQueue *queue) void g_async_queue_unref (GAsyncQueue *queue) { - gboolean stop; - g_return_if_fail (queue); g_return_if_fail (queue->ref_count > 0); diff --git a/glib/glib.h b/glib/glib.h index 799a07a..b05f2bf 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -147,6 +147,14 @@ extern "C" { #define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string) #define G_STRINGIFY_ARG(contents) #contents +/* provide a string identifying the current code position */ +#ifdef __GNUC__ +# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()" +#else +# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) +#endif + + /* Count the number of elements in an array. The array must be defined * as such; using this with a dynamically allocated array will give * incorrect results. @@ -171,9 +179,9 @@ extern "C" { * fields through their offsets. */ #define G_STRUCT_OFFSET(struct_type, member) \ - ((gulong) ((gchar*) &((struct_type*) 0)->member)) + ((glong) ((guint8*) &((struct_type*) 0)->member)) #define G_STRUCT_MEMBER_P(struct_p, struct_offset) \ - ((gpointer) ((gchar*) (struct_p) + (gulong) (struct_offset))) + ((gpointer) ((guint8*) (struct_p) + (glong) (struct_offset))) #define G_STRUCT_MEMBER(member_type, struct_p, struct_offset) \ (*(member_type*) G_STRUCT_MEMBER_P ((struct_p), (struct_offset))) @@ -1022,6 +1030,9 @@ GSList* g_slist_insert (GSList *list, GSList* g_slist_insert_sorted (GSList *list, gpointer data, GCompareFunc func); +GSList* g_slist_insert_before (GSList *slist, + GSList *sibling, + gpointer data); GSList* g_slist_concat (GSList *list1, GSList *list2); GSList* g_slist_remove (GSList *list, @@ -1567,6 +1578,9 @@ void g_usleep (gulong microseconds); gchar* g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter); +gchar* g_strcanon (gchar *string, + const gchar *valid_chars, + gchar subsitutor); gdouble g_strtod (const gchar *nptr, gchar **endptr); gchar* g_strerror (gint errnum); @@ -1576,9 +1590,9 @@ gint g_strcasecmp (const gchar *s1, gint g_strncasecmp (const gchar *s1, const gchar *s2, guint n); -void g_strdown (gchar *string); -void g_strup (gchar *string); -void g_strreverse (gchar *string); +gchar* g_strdown (gchar *string); +gchar* g_strup (gchar *string); +gchar* g_strreverse (gchar *string); /* removes leading spaces */ gchar* g_strchug (gchar *string); /* removes trailing spaces */ @@ -2054,6 +2068,7 @@ void g_dataset_foreach (gconstpointer dataset_location, /* Character sets */ #define G_CSET_A_2_Z "ABCDEFGHIJKLMNOPQRSTUVWXYZ" #define G_CSET_a_2_z "abcdefghijklmnopqrstuvwxyz" +#define G_CSET_DIGITS "0123456789" #define G_CSET_LATINC "\300\301\302\303\304\305\306"\ "\307\310\311\312\313\314\315\316\317\320"\ "\321\322\323\324\325\326"\ diff --git a/glib/gscanner.c b/glib/gscanner.c index bbcbc7f..55d5fb2 100644 --- a/glib/gscanner.c +++ b/glib/gscanner.c @@ -89,8 +89,9 @@ static GScannerConfig g_scanner_config_template = ) /* cset_identifier_first */, ( G_CSET_a_2_z - "_0123456789" + "_" G_CSET_A_2_Z + G_CSET_DIGITS G_CSET_LATINS G_CSET_LATINC ) /* cset_identifier_nth */, diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c index 927aca5..e4f633e 100644 --- a/glib/gstrfuncs.c +++ b/glib/gstrfuncs.c @@ -801,12 +801,12 @@ extern const char * strsignal(int); return msg; } -void +gchar* g_strdown (gchar *string) { register guchar *s; - g_return_if_fail (string != NULL); + g_return_val_if_fail (string != NULL, NULL); s = string; @@ -815,14 +815,16 @@ g_strdown (gchar *string) *s = tolower (*s); s++; } + + return string; } -void +gchar* g_strup (gchar *string) { register guchar *s; - g_return_if_fail (string != NULL); + g_return_val_if_fail (string != NULL, NULL); s = string; @@ -831,12 +833,14 @@ g_strup (gchar *string) *s = toupper (*s); s++; } + + return string; } -void +gchar* g_strreverse (gchar *string) { - g_return_if_fail (string != NULL); + g_return_val_if_fail (string != NULL, NULL); if (*string) { @@ -856,6 +860,8 @@ g_strreverse (gchar *string) t--; } } + + return string; } gint @@ -943,12 +949,31 @@ g_strdelimit (gchar *string, } gchar* +g_strcanon (gchar *string, + const gchar *valid_chars, + gchar subsitutor) +{ + register gchar *c; + + g_return_val_if_fail (string != NULL, NULL); + g_return_val_if_fail (valid_chars != NULL, NULL); + + for (c = string; *c; c++) + { + if (!strchr (valid_chars, *c)) + *c = subsitutor; + } + + return string; +} + +gchar* g_strcompress (const gchar *source) { const gchar *p = source, *octal; gchar *dest = g_malloc (strlen (source) + 1); gchar *q = dest; - + while (*p) { if (*p == '\\') @@ -993,6 +1018,7 @@ g_strcompress (const gchar *source) p++; } *q = 0; + return dest; } diff --git a/gscanner.c b/gscanner.c index bbcbc7f..55d5fb2 100644 --- a/gscanner.c +++ b/gscanner.c @@ -89,8 +89,9 @@ static GScannerConfig g_scanner_config_template = ) /* cset_identifier_first */, ( G_CSET_a_2_z - "_0123456789" + "_" G_CSET_A_2_Z + G_CSET_DIGITS G_CSET_LATINS G_CSET_LATINC ) /* cset_identifier_nth */, diff --git a/gstrfuncs.c b/gstrfuncs.c index 927aca5..e4f633e 100644 --- a/gstrfuncs.c +++ b/gstrfuncs.c @@ -801,12 +801,12 @@ extern const char * strsignal(int); return msg; } -void +gchar* g_strdown (gchar *string) { register guchar *s; - g_return_if_fail (string != NULL); + g_return_val_if_fail (string != NULL, NULL); s = string; @@ -815,14 +815,16 @@ g_strdown (gchar *string) *s = tolower (*s); s++; } + + return string; } -void +gchar* g_strup (gchar *string) { register guchar *s; - g_return_if_fail (string != NULL); + g_return_val_if_fail (string != NULL, NULL); s = string; @@ -831,12 +833,14 @@ g_strup (gchar *string) *s = toupper (*s); s++; } + + return string; } -void +gchar* g_strreverse (gchar *string) { - g_return_if_fail (string != NULL); + g_return_val_if_fail (string != NULL, NULL); if (*string) { @@ -856,6 +860,8 @@ g_strreverse (gchar *string) t--; } } + + return string; } gint @@ -943,12 +949,31 @@ g_strdelimit (gchar *string, } gchar* +g_strcanon (gchar *string, + const gchar *valid_chars, + gchar subsitutor) +{ + register gchar *c; + + g_return_val_if_fail (string != NULL, NULL); + g_return_val_if_fail (valid_chars != NULL, NULL); + + for (c = string; *c; c++) + { + if (!strchr (valid_chars, *c)) + *c = subsitutor; + } + + return string; +} + +gchar* g_strcompress (const gchar *source) { const gchar *p = source, *octal; gchar *dest = g_malloc (strlen (source) + 1); gchar *q = dest; - + while (*p) { if (*p == '\\') @@ -993,6 +1018,7 @@ g_strcompress (const gchar *source) p++; } *q = 0; + return dest; }