summaryrefslogtreecommitdiff
path: root/glib
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>2000-05-12 15:23:16 +0000
committerTim Janik <timj@src.gnome.org>2000-05-12 15:23:16 +0000
commit1df2ec98cbdc4789418f9652c9c90855c86b9dad (patch)
treef055b3ff5d2fb11bf6adc2715c0b7db706924fa6 /glib
parent397ad5881e972da23eccca1b20bbcfe2e8648f11 (diff)
downloadglib-1df2ec98cbdc4789418f9652c9c90855c86b9dad.tar.gz
added gobject
Fri Apr 28 23:54:35 2000 Tim Janik <timj@gtk.org> * 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 <timj@gtk.org> * 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 <timj@gtk.org> * gasyncqueue.c (g_async_queue_unref): get rid of an unused variable.
Diffstat (limited to 'glib')
-rw-r--r--glib/Makefile.am5
-rw-r--r--glib/gasyncqueue.c2
-rw-r--r--glib/glib.h25
-rw-r--r--glib/gscanner.c3
-rw-r--r--glib/gstrfuncs.c40
5 files changed, 57 insertions, 18 deletions
diff --git a/glib/Makefile.am b/glib/Makefile.am
index 95221d5ad..f66c3a25a 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 470d2a78f..16ef211ff 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 799a07a94..b05f2bf8f 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 bbcbc7fd8..55d5fb290 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 927aca58e..e4f633e71 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;
}