ref-filter: add an 'rstrip=<N>' option to atoms which deal with refnames
[gitweb.git] / sha1_name.c
index 06409a38451971121e6cf6abd4a8af5bffd231c1..73a915ff1b3278f08ef4f327a55fe61d238f720a 100644 (file)
@@ -510,7 +510,8 @@ const char *find_unique_abbrev(const unsigned char *sha1, int len)
 {
        static int bufno;
        static char hexbuffer[4][GIT_SHA1_HEXSZ + 1];
-       char *hex = hexbuffer[3 & ++bufno];
+       char *hex = hexbuffer[bufno];
+       bufno = (bufno + 1) % ARRAY_SIZE(hexbuffer);
        find_unique_abbrev_r(hex, sha1, len);
        return hex;
 }