From 3fec0a02651cd36c9c1f84cda1312ff3e144485b Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Fri, 16 Oct 2009 19:37:49 +0200 Subject: [PATCH] Adjust katze_(foo_)assign to work inside one-line if's --- katze/katze-utils.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/katze/katze-utils.h b/katze/katze-utils.h index 5d237d16..3cd418d6 100644 --- a/katze/katze-utils.h +++ b/katze/katze-utils.h @@ -34,11 +34,12 @@ G_BEGIN_DECLS * Frees @lvalue if needed and assigns it the value of @rvalue. **/ #define katze_assign(lvalue, rvalue) \ - if (1) \ + do \ { \ g_free (lvalue); \ lvalue = rvalue; \ - } + } \ + while (0) /** * katze_object_assign: @@ -48,12 +49,13 @@ G_BEGIN_DECLS * Unrefs @lvalue if needed and assigns it the value of @rvalue. **/ #define katze_object_assign(lvalue, rvalue) \ - if (1) \ + do \ { \ if (lvalue) \ g_object_unref (lvalue); \ lvalue = rvalue; \ - } + } \ + while (0) /** * katze_strv_assign: @@ -65,11 +67,12 @@ G_BEGIN_DECLS * Since: 0.1.7 **/ #define katze_strv_assign(lvalue, rvalue) \ - if (1) \ + do \ { \ g_strfreev (lvalue); \ lvalue = rvalue; \ - } + } \ + while (0) GtkWidget* katze_property_proxy (gpointer object, -- 2.39.5