From: Christian Dywan Date: Fri, 16 Oct 2009 17:37:49 +0000 (+0200) Subject: Adjust katze_(foo_)assign to work inside one-line if's X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fec0a02651cd36c9c1f84cda1312ff3e144485b;p=midori Adjust katze_(foo_)assign to work inside one-line if's --- 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,