Skip to content

Commit fa364ad

Browse files
bbolligitster
authored andcommitted
utf8: use ARRAY_SIZE() in git_wcwidth()
This macro has been available globally since b4f2a6a ("Use #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))", 2006-03-09), so let's use it. Signed-off-by: Beat Bolli <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5fa0f52 commit fa364ad

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

utf8.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,11 @@ static int git_wcwidth(ucs_char_t ch)
9595
return -1;
9696

9797
/* binary search in table of non-spacing characters */
98-
if (bisearch(ch, zero_width, sizeof(zero_width)
99-
/ sizeof(struct interval) - 1))
98+
if (bisearch(ch, zero_width, ARRAY_SIZE(zero_width) - 1))
10099
return 0;
101100

102101
/* binary search in table of double width characters */
103-
if (bisearch(ch, double_width, sizeof(double_width)
104-
/ sizeof(struct interval) - 1))
102+
if (bisearch(ch, double_width, ARRAY_SIZE(double_width) - 1))
105103
return 2;
106104

107105
return 1;

0 commit comments

Comments
 (0)