]> git.ipfire.org Git - thirdparty/git.git/blobdiff - dir.c
dir.[ch]: replace dir_init() with DIR_INIT
[thirdparty/git.git] / dir.c
diff --git a/dir.c b/dir.c
index ebe5ec046e050683443507495b3dcfa903c420e4..313e9324597a1ae1b03b3979be412b86ab63dcd0 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -53,12 +53,6 @@ static enum path_treatment read_directory_recursive(struct dir_struct *dir,
        int check_only, int stop_at_first_file, const struct pathspec *pathspec);
 static int resolve_dtype(int dtype, struct index_state *istate,
                         const char *path, int len);
-
-void dir_init(struct dir_struct *dir)
-{
-       memset(dir, 0, sizeof(*dir));
-}
-
 struct dirent *readdir_skip_dot_and_dotdot(DIR *dirp)
 {
        struct dirent *e;
@@ -3105,6 +3099,7 @@ void dir_clear(struct dir_struct *dir)
        struct exclude_list_group *group;
        struct pattern_list *pl;
        struct exclude_stack *stk;
+       struct dir_struct new = DIR_INIT;
 
        for (i = EXC_CMDL; i <= EXC_FILE; i++) {
                group = &dir->exclude_list_group[i];
@@ -3132,7 +3127,7 @@ void dir_clear(struct dir_struct *dir)
        }
        strbuf_release(&dir->basebuf);
 
-       dir_init(dir);
+       memcpy(dir, &new, sizeof(*dir));
 }
 
 struct ondisk_untracked_cache {