mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
global: trivial conversions to fix -Wsign-compare warnings
We have a bunch of loops which iterate up to an unsigned boundary using a signed index, which generates warnigs because we compare a signed and unsigned value in the loop condition. Address these sites for trivial cases and enable `-Wsign-compare` warnings for these code units. This patch only adapts those code units where we can drop the `DISABLE_SIGN_COMPARE_WARNINGS` macro in the same step. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
25435e4ad8
commit
80c9e70ebe
8
help.h
8
help.h
@@ -60,8 +60,7 @@ static inline void list_config_item(struct string_list *list,
|
||||
#define define_list_config_array(array) \
|
||||
void list_config_##array(struct string_list *list, const char *prefix) \
|
||||
{ \
|
||||
int i; \
|
||||
for (i = 0; i < ARRAY_SIZE(array); i++) \
|
||||
for (size_t i = 0; i < ARRAY_SIZE(array); i++) \
|
||||
if (array[i]) \
|
||||
list_config_item(list, prefix, array[i]); \
|
||||
} \
|
||||
@@ -70,11 +69,10 @@ struct string_list
|
||||
#define define_list_config_array_extra(array, values) \
|
||||
void list_config_##array(struct string_list *list, const char *prefix) \
|
||||
{ \
|
||||
int i; \
|
||||
static const char *extra[] = values; \
|
||||
for (i = 0; i < ARRAY_SIZE(extra); i++) \
|
||||
for (size_t i = 0; i < ARRAY_SIZE(extra); i++) \
|
||||
list_config_item(list, prefix, extra[i]); \
|
||||
for (i = 0; i < ARRAY_SIZE(array); i++) \
|
||||
for (size_t i = 0; i < ARRAY_SIZE(array); i++) \
|
||||
if (array[i]) \
|
||||
list_config_item(list, prefix, array[i]); \
|
||||
} \
|
||||
|
||||
Reference in New Issue
Block a user