garray macro () protection
- From: Dan Winship <danw helixcode com>
- To: gtk-devel-list gnome org
- Subject: garray macro () protection
- Date: Tue, 2 Jan 2001 15:36:30 -0500 (EST)
g_array_append_val(a, i+1) compiles, but doesn't do what it looks like
it does. This fixes that.
Should I commit it to the 1.2 branch too?
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/glib/ChangeLog,v
retrieving revision 1.577
diff -u -r1.577 ChangeLog
--- ChangeLog 2000/12/29 19:25:38 1.577
+++ ChangeLog 2001/01/02 20:00:06
@@ -1,3 +1,10 @@
+2001-01-02 Dan Winship <danw helixcode com>
+
+ * garray.h (g_array_append_val, g_array_prepend_val,
+ g_array_insert_val): Use parentheses around an argument to make
+ these cause an error if you pass a non-lvalue for the value,
+ rather than silently doing the wrong thing.
+
2000-12-29 Tor Lillqvist <tml iki fi>
* glibconfig.h.win32.in: Add GLIB_SIZEOF_VOID_P and GLIB_SIZEOF_LONG.
Index: garray.h
===================================================================
RCS file: /cvs/gnome/glib/garray.h,v
retrieving revision 1.2
diff -u -r1.2 garray.h
--- garray.h 2000/11/20 23:59:32 1.2
+++ garray.h 2001/01/02 20:00:06
@@ -58,9 +58,9 @@
* order by moving the last element to the position of the removed
*/
-#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_insert_val(a,i,v) g_array_insert_vals (a, i, &v, 1)
+#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_insert_val(a,i,v) g_array_insert_vals (a, i, &(v), 1)
#define g_array_index(a,t,i) (((t*) (a)->data) [(i)])
GArray* g_array_new (gboolean zero_terminated,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]