From 02499570c12eb678006d95948a7d8c39e5f78a53 Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 7 Mar 2005 20:32:56 +0000 Subject: [PATCH] improved ASSIGN/ASSIGNCOPY assignment behaviour git-svn-id: http://svn.opengroupware.org/SOPE/trunk@632 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-core/NGExtensions/ChangeLog | 5 +++++ .../NGExtensions/NGExtensions/NGObjectMacros.h | 14 ++++++++------ sope-core/NGExtensions/Version | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/sope-core/NGExtensions/ChangeLog b/sope-core/NGExtensions/ChangeLog index 4fb4f649..ed7092c0 100644 --- a/sope-core/NGExtensions/ChangeLog +++ b/sope-core/NGExtensions/ChangeLog @@ -1,3 +1,8 @@ +2005-03-07 Helge Hess + + * NGExtensions/NGObjectMacros.h: fixed ASSIGN, ASSIGNCOPY macros to + avoid an unset LHS as requested by Stephane (v4.5.155) + 2005-03-02 Marcus Mueller * NGCalendarDateRange.m: Bugfix for -containsDate: (v4.5.154) diff --git a/sope-core/NGExtensions/NGExtensions/NGObjectMacros.h b/sope-core/NGExtensions/NGExtensions/NGObjectMacros.h index 40b9ca26..8c0b127b 100644 --- a/sope-core/NGExtensions/NGExtensions/NGObjectMacros.h +++ b/sope-core/NGExtensions/NGExtensions/NGObjectMacros.h @@ -26,17 +26,19 @@ # define ASSIGN(object, value) \ ({id __object = (id)object; \ id __value = (id)value; \ - if (__value != __object) { if (__value) [__value retain]; \ - if (__object) [__object release]; \ - object = __value;}}) + if (__value != __object) { \ + object = (__value) ? [__value retain] : nil; \ + if (__object) [__object release]; \ + }}) #endif #ifndef ASSIGNCOPY # define ASSIGNCOPY(object, value) \ ({id __object = (id)object; \ id __value = (id)value; \ - if (__value != __object) { if (__value) __value = [__value copy]; \ - if (__object) [__object release]; \ - object = __value;}}) + if (__value != __object) { \ + object = __value ? [__value copy] : nil; \ + if (__object) [__object release]; \ + }}) #endif #ifndef RETAIN # define RETAIN(__XXX__) [__XXX__ retain] diff --git a/sope-core/NGExtensions/Version b/sope-core/NGExtensions/Version index d0fd569f..96b00005 100644 --- a/sope-core/NGExtensions/Version +++ b/sope-core/NGExtensions/Version @@ -1,6 +1,6 @@ # version -SUBMINOR_VERSION:=154 +SUBMINOR_VERSION:=155 # v4.3.115 requires libFoundation v1.0.59 # v4.2.72 requires libEOControl v4.2.39 -- 2.39.5