utf8: use ARRAY_SIZE() in git_wcwidth()
This macro has been available globally since b4f2a6ac92 ("Use #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))", 2006-03-09), so let's use it. Signed-off-by: Beat Bolli <dev+git@drbeat.li> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Beat Bolli committed
Oct 11, 2019 at 20:41 UTC
fa364ad790ae0a778ba14b5e5fc9fe910ab4b67e
1 file changed
+2
-4
utf8.c
+2
-4
@@ -95,13 +95,11 @@ static int git_wcwidth(ucs_char_t ch)
95
return -1;
96
97
/* 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))
99
return 0;
100
101
/* 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))
103
return 2;
104
105
return 1;