diff options
-rw-r--r-- | glib/ChangeLog | 14 | ||||
-rw-r--r-- | glib/glib.h | 4 | ||||
-rw-r--r-- | glib/glist.c | 10 | ||||
-rw-r--r-- | glib/gscanner.c | 5 | ||||
-rw-r--r-- | glib/gslist.c | 10 |
5 files changed, 40 insertions, 3 deletions
diff --git a/glib/ChangeLog b/glib/ChangeLog index d7a276ba83..541430f3c3 100644 --- a/glib/ChangeLog +++ b/glib/ChangeLog @@ -1,8 +1,16 @@ +Sun May 17 10:48:27 1998 Tim Janik <timj@gtk.org> + + * gscanner.c (g_scanner_unexp_token): provide usefull default + specifications for identifier_spec and symbol_spec. + + * glib.h: new functions g_slist_nth_data and g_list_nth_data to return + the data of the nth element in the list. + Fri May 15 22:31:49 1998 Tim Janik <timj@gtk.org> - * gscanner.c (g_scanner_unexp_token): removed sputious va_end(args) that - for some reason didn't produce a compiler wrning on my machine (is - va_end undefined for i386?). + * gscanner.c (g_scanner_unexp_token): removed spurious va_end(args) + that for some reason didn't produce a compiler wrning on my machine + (is va_end undefined for i386?). Fri May 15 12:32:08 1998 rodo <doulik@karlin.mff.cuni.cz> diff --git a/glib/glib.h b/glib/glib.h index 9ee044f745..282288c977 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -518,6 +518,8 @@ guint g_list_length (GList *list); void g_list_foreach (GList *list, GFunc func, gpointer user_data); +gpointer g_list_nth_data (GList *list, + guint n); #define g_list_previous(list) ((list) ? (((GList *)list)->prev) : NULL) #define g_list_next(list) ((list) ? (((GList *)list)->next) : NULL) @@ -558,6 +560,8 @@ guint g_slist_length (GSList *list); void g_slist_foreach (GSList *list, GFunc func, gpointer user_data); +gpointer g_slist_nth_data (GSList *list, + guint n); #define g_slist_next(list) ((list) ? (((GSList *)list)->next) : NULL) diff --git a/glib/glist.c b/glib/glist.c index 06cfd54905..a24751cbc3 100644 --- a/glib/glist.c +++ b/glib/glist.c @@ -300,6 +300,16 @@ g_list_nth (GList *list, return list; } +gpointer +g_list_nth_data (GList *list, + guint n) +{ + while ((n-- > 0) && list) + list = list->next; + + return list ? list->data : NULL; +} + GList* g_list_find (GList *list, gpointer data) diff --git a/glib/gscanner.c b/glib/gscanner.c index 529d7e76e0..d8f7f6805a 100644 --- a/glib/gscanner.c +++ b/glib/gscanner.c @@ -665,6 +665,11 @@ g_scanner_unexp_token (GScanner *scanner, msg_handler = g_scanner_error; else msg_handler = g_scanner_warn; + + if (!identifier_spec) + identifier_spec = "identifier"; + if (!symbol_spec) + symbol_spec = "symbol"; token_string_len = 56; token_string = g_new (gchar, token_string_len + 1); diff --git a/glib/gslist.c b/glib/gslist.c index e608f131e8..636dd37dc4 100644 --- a/glib/gslist.c +++ b/glib/gslist.c @@ -289,6 +289,16 @@ g_slist_nth (GSList *list, return list; } +gpointer +g_slist_nth_data (GSList *list, + guint n) +{ + while ((n-- > 0) && list) + list = list->next; + + return list ? list->data : NULL; +} + GSList* g_slist_find (GSList *list, gpointer data) |