On Mar 10, 2009, at 3:35 PM, Bert Huijben wrote:
>> -----Original Message-----
>> From: Hyrum K. Wright [mailto:hyrum_at_hyrumwright.org]
>> Sent: Tuesday, March 10, 2009 9:21 PM
>> To: svn_at_subversion.tigris.org
>> Subject: svn commit: r36467 - trunk/subversion/libsvn_wc
>>
>> Author: hwright
>> Date: Tue Mar 10 13:21:27 2009
>> New Revision: 36467
>>
>> Log:
>> Unfortunately, C doesn't have a logical XOR, but we can do better
>> than
>> !AB + A!B.
>>
>> * subversion/libsvn_wc/status.c
>> (assemble_status): More simply simulate an exclusive OR condition.
>>
>> Modified:
>> trunk/subversion/libsvn_wc/status.c
>>
>> Modified: trunk/subversion/libsvn_wc/status.c
>> URL:
>> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/status.c?pa
>> threv=36467&r1=36466&r2=36467
>> =
>> =
>> =====================================================================
>> =======
>> --- trunk/subversion/libsvn_wc/status.c Tue Mar 10 12:23:40 2009
>> (r36466)
>> +++ trunk/subversion/libsvn_wc/status.c Tue Mar 10 13:21:27 2009
>> (r36467)
>> @@ -502,9 +502,7 @@ assemble_status(svn_wc_status2_t **statu
>> else if (path_kind != entry->kind)
>> final_text_status = svn_wc_status_obstructed;
>> #ifdef HAVE_SYMLINK
>> - else if (((! wc_special) && (path_special))
>> - || (wc_special && (! path_special))
>> - )
>> + else if ( wc_special != path_special)
>
> Are you sure the true values are always 1 (=TRUE) here?
>
> In that case you can just use the bitwise xor operator.
>
> If not you should use something like !wc_special != !path_special.
> (Uglier than the original :))
We declare them as booleans and elsewhere we test their equality, so I
think this is safe. If there is wonkiness here, the bug lies not in
this check, but in the place the boolean is being set to something
other than TRUE or FALSE.
-Hyrum
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1304716
Received on 2009-03-10 21:44:42 CET