Simplify definitions of katze assignment macros

This commit is contained in:
Christian Dywan 2010-09-18 01:45:17 +02:00
parent 304d99903a
commit d0e2433f86

View file

@ -34,13 +34,7 @@ G_BEGIN_DECLS
* *
* Frees @lvalue if needed and assigns it the value of @rvalue. * Frees @lvalue if needed and assigns it the value of @rvalue.
**/ **/
#define katze_assign(lvalue, rvalue) \ #define katze_assign(lvalue, rvalue) lvalue = (g_free (lvalue), rvalue)
do \
{ \
g_free (lvalue); \
lvalue = rvalue; \
} \
while (0)
/** /**
* katze_object_assign: * katze_object_assign:
@ -50,13 +44,7 @@ G_BEGIN_DECLS
* Unrefs @lvalue if needed and assigns it the value of @rvalue. * Unrefs @lvalue if needed and assigns it the value of @rvalue.
**/ **/
#define katze_object_assign(lvalue, rvalue) \ #define katze_object_assign(lvalue, rvalue) \
do \ lvalue = ((lvalue ? g_object_unref (lvalue) : lvalue), rvalue)
{ \
if (lvalue) \
g_object_unref (lvalue); \
lvalue = rvalue; \
} \
while (0)
/** /**
* katze_strv_assign: * katze_strv_assign:
@ -67,13 +55,7 @@ G_BEGIN_DECLS
* *
* Since: 0.1.7 * Since: 0.1.7
**/ **/
#define katze_strv_assign(lvalue, rvalue) \ #define katze_strv_assign(lvalue, rvalue) lvalue = (g_strfreev (lvalue), rvalue)
do \
{ \
g_strfreev (lvalue); \
lvalue = rvalue; \
} \
while (0)
GtkWidget* GtkWidget*
katze_property_proxy (gpointer object, katze_property_proxy (gpointer object,