Skip to content

Commit ce6f61d

Browse files
committed
attrcache: remove useless do_init indirection
Remove useless indirection from `git_attr_cache__init` to `git_attr_cache__do_init`. The difference is that the `git_attr_cache__init` macro first checks if the cache is already initialized and, if so, not call `git_attr_cache__do_init`. But actually, `git_attr_cache__do_init` already does the same thing and returns immediately if the cache is already initialized. Remove the indirection.
1 parent c115101 commit ce6f61d

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/attrcache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static void attr_cache__free(git_attr_cache *cache)
354354
git__free(cache);
355355
}
356356

357-
int git_attr_cache__do_init(git_repository *repo)
357+
int git_attr_cache__init(git_repository *repo)
358358
{
359359
int ret = 0;
360360
git_attr_cache *cache = git_repository_attr_cache(repo);

src/attrcache.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@ typedef struct {
2222
git_pool pool;
2323
} git_attr_cache;
2424

25-
extern int git_attr_cache__do_init(git_repository *repo);
26-
27-
#define git_attr_cache__init(REPO) \
28-
(git_repository_attr_cache(REPO) ? 0 : git_attr_cache__do_init(REPO))
25+
extern int git_attr_cache__init(git_repository *repo);
2926

3027
/* get file - loading and reload as needed */
3128
extern int git_attr_cache__get(

0 commit comments

Comments
 (0)