[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Suboptimal and suspicious patterns using COM macros and functions

From: Dmitry <wipedout_at_yandex.ru>
Date: Tue, 11 Aug 2009 11:30:41 +0400


I was reading sources of TSVN (latest version) and stumbled upon two minor things:

1. In src\SubWCRev\Register.cpp and src\TortoiseShell\ItemIDList.cpp when checking HRESULT values the check is done like this: if( !SUCCEEDED( res ) ) {} . Instead FAILED macro could be used ( if ( FAILED( res ) ) {} ) - this would give exactly the same effect and more readable code.

2. In src\TortoiseShell\ItemIDList.cpp near the end of ItemIDList::toString() method there's a condition:
           if (szDisplayName == NULL)
                return ret; //to avoid a crash!
The call to CoTaskMemFree() will have no effect if szDisplayName is NULL - this call only pollutes the code.

I suggest these minor code defects are refined.

Best wishes.


To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2009-08-11 09:31:15 CEST

This is an archived mail posted to the TortoiseSVN Dev mailing list.