D943: chg: move only first time relevant if condition out of loop
singhsrb (Saurabh Singh)
phabricator at mercurial-scm.org
Fri Oct 6 18:37:47 UTC 2017
singhsrb added a comment.
@simpkins I definitely prefer
int i;
for (i = 0; i < argc; ++i) {
if (strcmp(argv[i], "--") == 0) {
break;
} else if (strcmp("-d", argv[i]) == 0 ||
strcmp("--daemon", argv[i]) == 0) {
if (strcmp("serve", argv[0]) == 0)
return 1;
} else if (strcmp("--time", argv[i]) == 0) {
return 1;
}
}
return 0;
as it avoids the need to check for "--serve" if we never saw "--daemon". Also, avoids the early return in the second option. I did not notice that we were only checking for the SERVEDAEMON and hence, this was also an option :).
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D943
To: singhsrb, #hg-reviewers, yuja
Cc: simpkins, yuja, quark, mercurial-devel
More information about the Mercurial-devel
mailing list