From: <ag...@us...> - 2011-09-26 02:38:03
|
Revision: 2494 http://zoolib.svn.sourceforge.net/zoolib/?rev=2494&view=rev Author: agreen Date: 2011-09-26 02:37:57 +0000 (Mon, 26 Sep 2011) Log Message: ----------- Simplify sCallCogChanged. Modified Paths: -------------- trunk/zoolib/source/cxx/zoolib/ZCog.h Modified: trunk/zoolib/source/cxx/zoolib/ZCog.h =================================================================== --- trunk/zoolib/source/cxx/zoolib/ZCog.h 2011-09-26 02:37:06 UTC (rev 2493) +++ trunk/zoolib/source/cxx/zoolib/ZCog.h 2011-09-26 02:37:57 UTC (rev 2494) @@ -116,26 +116,15 @@ template <class Cog> bool sCallCogChanged(Cog& ioCog, const typename Cog::Param iParam) - { - if (ioCog) - { - Cog result = ioCog->Call(ioCog, iParam); - if (ioCog != result) - { - ioCog = result; - return true; - } - } - return false; - } + { return ioCog && sCompareAndSet(ioCog, ioCog->Call(ioCog, iParam)); } template <class Cog> bool sCallCogUnchanged(Cog& ioCog, const typename Cog::Param iParam) - { return not sCallCogChanged(ioCog, iParam); } + { return not ioCog || not sCompareAndSet(ioCog, ioCog->Call(ioCog, iParam)); } // ================================================================================================= #pragma mark - -#pragma mark * sCog +#pragma mark * sCog function and pseudo operator const struct { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |