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

Patch: Remove redundant checks

From: Dmitry <wipedout_at_yandex.ru>
Date: Tue, 22 Dec 2009 17:55:33 +0300

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.

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.

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.

The attached patch removes redundant checks for null pointers, marks the suspicious snippet, rewrites the BSTR->CString conversions and also adds some minor changes.

Best wishes.
Dmitry.

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

To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].

Received on 2009-12-22 16:43:01 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.