D943: chg: move only first time relevant if condition out of loop

singhsrb (Saurabh Singh) phabricator at mercurial-scm.org
Fri Oct 6 13:21:59 EDT 2017


singhsrb added a comment.


  I just refactored the code a little more to take care of redundant loop execution check when `argc == 0`. I am guessing you mean you don't like the code in terms of readability because at runtime, this commit is strictly at least equal or better than the earlier code except for the case when the first argument is "--" (which i am guessing is not very common). Effectively, the extra argc check replaces the `i == 0` check in each iteration and the seemingly extra `i++` essentially mimics the `i++` at the end of the first iteration.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D943

To: singhsrb, #hg-reviewers, yuja
Cc: yuja, quark, mercurial-devel


More information about the Mercurial-devel mailing list