summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2016-07-30 18:18:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-08-01 21:01:03 (GMT)
commit50492f7b38f84619cbfb443efc3c0c78fc0304dd (patch)
tree051c7b006815c0c55c8c37039cb9877402b56a1b /refs.c
parentf8f7adce9fc50a11a764d57815602dcb818d1816 (diff)
downloadgit-50492f7b38f84619cbfb443efc3c0c78fc0304dd.zip
git-50492f7b38f84619cbfb443efc3c0c78fc0304dd.tar.gz
git-50492f7b38f84619cbfb443efc3c0c78fc0304dd.tar.bz2
pass constants as first argument to st_mult()
The result of st_mult() is the same no matter the order of its arguments. It invokes the macro unsigned_mult_overflows(), which divides the second parameter by the first one. Pass constants first to allow that division to be done already at compile time. Signed-off-by: Rene Scharfe <l.s.r@web.de> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index 814cad3..b4e7cac 100644
--- a/refs.c
+++ b/refs.c
@@ -922,7 +922,7 @@ char *shorten_unambiguous_ref(const char *refname, int strict)
/* -2 for strlen("%.*s") - strlen("%s"); +1 for NUL */
total_len += strlen(ref_rev_parse_rules[nr_rules]) - 2 + 1;
- scanf_fmts = xmalloc(st_add(st_mult(nr_rules, sizeof(char *)), total_len));
+ scanf_fmts = xmalloc(st_add(st_mult(sizeof(char *), nr_rules), total_len));
offset = 0;
for (i = 0; i < nr_rules; i++) {