g_list_previous() / g_list_next()
- From: Danek Duvall <duvall lorien emufarm org>
- To: gtk-devel-list gnome org
- Subject: g_list_previous() / g_list_next()
- Date: Sun, 18 Jun 2000 20:52:33 -0700
Using Sun's C compiler (WorkShop 5.0), I get a load of errors compiling
xmms (bear with me a moment). Most of these errors look like the
following:
"util.c", line 381: non-unique member requires struct/union pointer: data
"util.c", line 381: left operand of "->" must be pointer to struct/union
Line 381 is:
list->data = g_list_next(list)->data;
I've been patching each individual problem line by casting the result of
g_list_next (or _previous) to a GList *. Thus:
list->data = ((GList *)g_list_next(list))->data;
However, I noticed that it is possible to correct the problem by patching
glib.h instead to do the cast ahead of time:
--- /export/include/glib.h Tue Jun 29 11:55:23 1999
+++ glib.h Sun Jun 18 20:47:12 2000
@@ -894,8 +894,8 @@
GCompareFunc compare_func);
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)
+#define g_list_previous(list) ((GList *)((list) ? (((GList *)(list))->prev) : NULL))
+#define g_list_next(list) ((GList *)((list) ? (((GList *)(list))->next) : NULL))
/* Singly linked lists
In some sense, this is probably correct, as the developer expects a GList *
in return (and that would happen if these were functions), not sometimes a
GList * and sometimes a void * (or however else NULL is implemented).
The patch was made to 1.2.3, but should apply to 1.2.8 as well.
Thanks for your consideration,
Danek
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]