gap-dev-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gap-dev-discuss] Cythiune : fix badly written macros causing nasty cras


From: Philippe Roussel
Subject: [Gap-dev-discuss] Cythiune : fix badly written macros causing nasty crashes
Date: Thu, 17 May 2012 13:12:12 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Hi,

The ChangeLog entry says it all.

Philippe

Index: ChangeLog
===================================================================
RCS file: /sources/gap/gap/user-apps/Cynthiune/ChangeLog,v
retrieving revision 1.46
diff -u -r1.46 ChangeLog
--- ChangeLog   16 May 2012 16:28:33 -0000      1.46
+++ ChangeLog   17 May 2012 11:09:34 -0000
@@ -1,3 +1,13 @@
+2012-05-17  Philippe Roussel  <address@hidden>
+
+       * Frameworks/Cynthiune/utils.h
+       Fix badly written macros SET and RELEASEIFSET (which could be replaced
+       by GNUstep's ASSIGN and RELEASE) to not have side effects.
+       The following code in VorbisTags.m
+         if (cComment)
+            SET (*string, [NSString stringWithUTF8String: cComment]);
+       wasn't functioning as planned because of the missing curly brackets
+
 2012-05-15 Riccardo Mottola <address@hidden>

        * PlaylistController.m
Index: Frameworks/Cynthiune/utils.h
===================================================================
RCS file:
/sources/gap/gap/user-apps/Cynthiune/Frameworks/Cynthiune/utils.h,v
retrieving revision 1.2
diff -u -r1.2 utils.h
--- Frameworks/Cynthiune/utils.h        30 Apr 2012 15:54:30 -0000      1.2
+++ Frameworks/Cynthiune/utils.h        17 May 2012 11:09:34 -0000
@@ -30,8 +30,17 @@

 @class NSArray;

-#define SET(X,Y) if (X) [X release]; X = Y; if (X) [X retain]
-#define RELEASEIFSET(X) if (X) [X release]
+#define SET(X,Y) do { \
+  if (X) \
+    [X release]; \
+  X = Y; \
+  if (X) \
+    [X retain]; \
+} while (0)
+#define RELEASEIFSET(X) do { \
+  if (X) \
+    [X release]; \
+} while (0)
 #define RETURNSTRING(X) return ((X) ? [NSString stringWithString: X] : @"")

 #ifdef __MACOSX__



reply via email to

[Prev in Thread] Current Thread [Next in Thread]