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

Re: Patch: Remove redundant checks

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Tue, 22 Dec 2009 19:44:41 +0100

On 22.12.2009 15:55, Dmitry wrote:
> Hey.
>
> Looking through TSVN code I've noticed the following suboptimal
> pattern: checking for null pointer before "delete". That check is
> redundant - "delete" is guaranteed to do nothing on a null pointer.
> The checking code only inflates the codebase.

Well, that's up for debate. The compiler optimizes usually those
statements away, but it's nice to have the check in the debug build to
set breakpoints easier.

> Also in TortoiseProc/RevisionGraph/SearchPathTree.cpp I found some
> strange code pattern that I marked with a comment. I suggest it is
> reviewed - looks like a severe bug.

That code is actually correct.

> Also there's a couple of snippets where BSTR is blindly assigned to
> CString. This is bad idea - BSTR can be a null pointer and CString
> implementaton will exhibit undefined behaviour.

Nope, not undefined. Assigning NULL to a CString creates an empty string.

Committed your patch in r18092.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2432389
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2009-12-22 19:44:53 CET

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.