diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2017-08-26 10:28:01 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-26 09:21:01 -0700 |
commit | 65eb8e0ca79d4a58768f9409b24c48a95d39bc55 (patch) | |
tree | 836945d08ff835e5128fa677a796120d53323951 /notes.c | |
parent | edc74bc7f0c6884027e851ef09b2e0c9380dcd45 (diff) | |
download | git-65eb8e0ca79d4a58768f9409b24c48a95d39bc55.tar.gz |
notes: make GET_NIBBLE macro more robust
Put parentheses around sha1. Otherwise it could fail for something
like
GET_NIBBLE(n, (unsigned char *)data);
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'notes.c')
-rw-r--r-- | notes.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -64,7 +64,7 @@ struct non_note { #define CLR_PTR_TYPE(ptr) ((void *) ((uintptr_t) (ptr) & ~3)) #define SET_PTR_TYPE(ptr, type) ((void *) ((uintptr_t) (ptr) | (type))) -#define GET_NIBBLE(n, sha1) (((sha1[(n) >> 1]) >> ((~(n) & 0x01) << 2)) & 0x0f) +#define GET_NIBBLE(n, sha1) ((((sha1)[(n) >> 1]) >> ((~(n) & 0x01) << 2)) & 0x0f) #define KEY_INDEX (GIT_SHA1_RAWSZ - 1) #define FANOUT_PATH_SEPARATORS ((GIT_SHA1_HEXSZ / 2) - 1) |