@@ -846,9 +846,7 @@ static int macroexpand_one(int nr, int rem)
846
846
* check_all_attr. If num is non-zero, only attributes in check[] are
847
847
* collected. Otherwise all attributes are collected.
848
848
*/
849
- static void collect_some_attrs (const char * path , int num ,
850
- struct attr_check_item * check )
851
-
849
+ static void collect_some_attrs (const char * path , struct attr_check * check )
852
850
{
853
851
struct attr_stack * stk ;
854
852
int i , pathlen , rem , dirlen ;
@@ -871,17 +869,18 @@ static void collect_some_attrs(const char *path, int num,
871
869
prepare_attr_stack (path , dirlen );
872
870
for (i = 0 ; i < attr_nr ; i ++ )
873
871
check_all_attr [i ].value = ATTR__UNKNOWN ;
874
- if (num && !cannot_trust_maybe_real ) {
872
+ if (check -> nr && !cannot_trust_maybe_real ) {
875
873
rem = 0 ;
876
- for (i = 0 ; i < num ; i ++ ) {
877
- if (!check [i ].attr -> maybe_real ) {
874
+ for (i = 0 ; i < check -> nr ; i ++ ) {
875
+ const struct git_attr * a = check -> items [i ].attr ;
876
+ if (!a -> maybe_real ) {
878
877
struct attr_check_item * c ;
879
- c = check_all_attr + check [ i ]. attr -> attr_nr ;
878
+ c = check_all_attr + a -> attr_nr ;
880
879
c -> value = ATTR__UNSET ;
881
880
rem ++ ;
882
881
}
883
882
}
884
- if (rem == num )
883
+ if (rem == check -> nr )
885
884
return ;
886
885
}
887
886
@@ -890,18 +889,17 @@ static void collect_some_attrs(const char *path, int num,
890
889
rem = fill (path , pathlen , basename_offset , stk , rem );
891
890
}
892
891
893
- static int git_check_attrs (const char * path , int num ,
894
- struct attr_check_item * check )
892
+ int git_check_attr (const char * path , struct attr_check * check )
895
893
{
896
894
int i ;
897
895
898
- collect_some_attrs (path , num , check );
896
+ collect_some_attrs (path , check );
899
897
900
- for (i = 0 ; i < num ; i ++ ) {
901
- const char * value = check_all_attr [check [i ].attr -> attr_nr ].value ;
898
+ for (i = 0 ; i < check -> nr ; i ++ ) {
899
+ const char * value = check_all_attr [check -> items [i ].attr -> attr_nr ].value ;
902
900
if (value == ATTR__UNKNOWN )
903
901
value = ATTR__UNSET ;
904
- check [i ].value = value ;
902
+ check -> items [i ].value = value ;
905
903
}
906
904
907
905
return 0 ;
@@ -912,7 +910,7 @@ void git_all_attrs(const char *path, struct attr_check *check)
912
910
int i ;
913
911
914
912
attr_check_reset (check );
915
- collect_some_attrs (path , check -> nr , check -> items );
913
+ collect_some_attrs (path , check );
916
914
917
915
for (i = 0 ; i < attr_nr ; i ++ ) {
918
916
const char * name = check_all_attr [i ].attr -> name ;
@@ -925,11 +923,6 @@ void git_all_attrs(const char *path, struct attr_check *check)
925
923
}
926
924
}
927
925
928
- int git_check_attr (const char * path , struct attr_check * check )
929
- {
930
- return git_check_attrs (path , check -> nr , check -> items );
931
- }
932
-
933
926
void git_attr_set_direction (enum git_attr_direction new , struct index_state * istate )
934
927
{
935
928
enum git_attr_direction old = direction ;
0 commit comments