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

Re: Suboptimal and suspicious patterns using COM macros and functions

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

steveking wrote:

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

>here, the if() clause is not because of CoTaskMemFree() but because the
>next line
>ret = szDisplayName;
>would crash if szDisplayName is NULL (you can't assign NULL to an
>std::string).

Yeap, I understand that. This part is necessary. I wanted to say that the call to CoTaskMemFree() is redundant.

Dmitry.

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2382391

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

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