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

Re: Patch: reducing amount of duplicate code

From: Stefan Fuhrmann <stefanfuhrmann_at_alice-dsl.de>
Date: Fri, 4 Sep 2009 14:59:53 +0200

Dmitry <wipedout_at_yandex.ru> wrote:

> More of the same. Now factoring out the code for showing an error
message. Later I'll invent
> something object-oriented so that there's no more need in calling
FormatMessage() with 6 lines of
> parameters noone cares of.

Committed as r17116.

Once you are at it, there are a few points where you could
improve your code:

* Add error handling for CreateProcess
  (e.g. like the FormatMessage code in ContextMenu.cpp)
* make sure you show the right application string
  (TSVN, TMerge, ...) in the message box. It can be derived
  from the main module name.
  Don't forget to map 'TortoiseProc' -> 'TortoiseSVN'

* Move the individual 'RunCommand' methods to a central
  place. CCreateProcessHelper would be fine.
* Add CreateProcessHelper.cpp so that we don't have to
  inline these functions anymore.

> Btw in the previous patch the whole point was that the helper class
zeroed out the
> PROCESS_INFORMATION, so the caller code has no need to do it. Removed
unnecessary memset() calls
> in the caller code.

Committed as r17115.

Thanks for the patches!
-- Stefan^2.

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

To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2009-09-04 15:00:01 CEST

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.