shorten_unambiguous_ref(): tighten up pointer arithmetic

As long as we're being pathologically stingy with mallocs, we might as well do the math right and save 6 (!) bytes. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Jan 8, 2014 at 15:43 UTC 7902fe03f97e2e74f95c96b8d18a7752bbb2ef6a
1 file changed +2 -2
refs.c
+2 -2
@@ -3353,8 +3353,8 @@ char *shorten_unambiguous_ref(const char *refname, int strict)
3353
3354 /* the rule list is NULL terminated, count them first */
3355 for (nr_rules = 0; ref_rev_parse_rules[nr_rules]; nr_rules++)
3356 - /* no +1 because strlen("%s") < strlen("%.*s") */
3357 - total_len += strlen(ref_rev_parse_rules[nr_rules]);
3356 + /* -2 for strlen("%.*s") - strlen("%s"); +1 for NUL */
3357 + total_len += strlen(ref_rev_parse_rules[nr_rules]) - 2 + 1;
3358
3359 scanf_fmts = xmalloc(nr_rules * sizeof(char *) + total_len);
3360