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

Re: Patch - unnecessary actions

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Thu, 04 Aug 2011 18:44:56 +0200

On 04.08.2011 00:26, Oto BREZINA wrote:
> On 2011-08-03 8:05, Dmitry wrote:
>> Hey.
>>
>> Attached is an untested patch that addresses hardcoded constants and also code that uncodnitionally does a change and then conditionaly overrides it instead of doing one of two changes depending on condition.
> According how is defined macro
> ADDTOCLIPBOARDSTRING(x) sClipboard += sClipboard.IsEmpty() ? x : L"\t" + x
>
> sequences like:
> if (selection& SVNSLC_COLREMOTEREVISION)
> {
> if (entry->remoterev<= 0)
> temp.Empty();
> else
> temp.Format(_T("%ld"), entry->remoterev);
> ADDTOCLIPBOARDSTRING(temp);
> }
>
> can become to:
>
> if (selection& SVNSLC_COLREMOTEREVISION)
> {
> if (entry->remoterev> 0)
> {
> temp.Format(_T("%ld"), entry->remoterev);
> ADDTOCLIPBOARDSTRING(temp);
> }
> }
>
> or maybe have two macros one for unconditionally add nonempty string one
> as is would make code even cleaner removing unnecessary tests and adding
> empty strings

Not really. Even if temp is empty (as it's now set if required) the tab
has to be added if the clipboard string is not empty.

Assume sClipboard contains "filename".
after the original sequence, sClipboard is either
filename\t
or
filename\tremoterev

but with your suggested sequence, it would be
filename
or
filename\tremoverev

That's not the same :)

> Side question how good is VS to use merged strings? From my expirence
> using single object (CString) save some conversions and space. This is
> minor trought.

Can you explain in more detail what you want to do?

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=2809137
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2011-08-04 18:45:26 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.