Skip to content

Commit

Permalink
sha1_name: don't waste cycles in the @-parsing loop
Browse files Browse the repository at this point in the history
The @-parsing loop unnecessarily checks for the sequence "@{" from
(len - 2) unnecessarily.  We can safely check from (len - 4).

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Ramkumar Ramachandra authored and Junio C Hamano committed May 8, 2013
1 parent b5f769a commit e883a05
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sha1_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
/* basic@{time or number or -number} format to query ref-log */
reflog_len = at = 0;
if (len && str[len-1] == '}') {
for (at = len-2; at >= 0; at--) {
for (at = len-4; at >= 0; at--) {
if (str[at] == '@' && str[at+1] == '{') {
if (!upstream_mark(str + at, len - at)) {
reflog_len = (len-1) - (at+2);
Expand Down

0 comments on commit e883a05

Please sign in to comment.