From e3c9221e8c32b86d0d297ed5fba0ec79c62378a7 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 2 Jan 2001 20:52:05 +0000 Subject: [PATCH] Use parentheses around an argument to make these cause an error if you * 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. --- ChangeLog | 7 +++++++ ChangeLog.pre-2-0 | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-12 | 7 +++++++ ChangeLog.pre-2-2 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ garray.h | 6 +++--- glib/garray.h | 6 +++--- 10 files changed, 62 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 582d21d1e..0fb944438 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-01-02 Dan Winship + + * 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 * glibconfig.h.win32.in: Add GLIB_SIZEOF_VOID_P and GLIB_SIZEOF_LONG. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 582d21d1e..0fb944438 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,10 @@ +2001-01-02 Dan Winship + + * 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 * glibconfig.h.win32.in: Add GLIB_SIZEOF_VOID_P and GLIB_SIZEOF_LONG. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 582d21d1e..0fb944438 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2001-01-02 Dan Winship + + * 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 * glibconfig.h.win32.in: Add GLIB_SIZEOF_VOID_P and GLIB_SIZEOF_LONG. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 582d21d1e..0fb944438 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,10 @@ +2001-01-02 Dan Winship + + * 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 * glibconfig.h.win32.in: Add GLIB_SIZEOF_VOID_P and GLIB_SIZEOF_LONG. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 582d21d1e..0fb944438 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +2001-01-02 Dan Winship + + * 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 * glibconfig.h.win32.in: Add GLIB_SIZEOF_VOID_P and GLIB_SIZEOF_LONG. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 582d21d1e..0fb944438 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +2001-01-02 Dan Winship + + * 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 * glibconfig.h.win32.in: Add GLIB_SIZEOF_VOID_P and GLIB_SIZEOF_LONG. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 582d21d1e..0fb944438 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +2001-01-02 Dan Winship + + * 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 * glibconfig.h.win32.in: Add GLIB_SIZEOF_VOID_P and GLIB_SIZEOF_LONG. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 582d21d1e..0fb944438 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +2001-01-02 Dan Winship + + * 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 * glibconfig.h.win32.in: Add GLIB_SIZEOF_VOID_P and GLIB_SIZEOF_LONG. diff --git a/garray.h b/garray.h index 4359c88ac..ddade3688 100644 --- a/garray.h +++ b/garray.h @@ -58,9 +58,9 @@ struct _GPtrArray * 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, diff --git a/glib/garray.h b/glib/garray.h index 4359c88ac..ddade3688 100644 --- a/glib/garray.h +++ b/glib/garray.h @@ -58,9 +58,9 @@ struct _GPtrArray * 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,