diff options
| author | Junio C Hamano <gitster@pobox.com> | 2021-07-16 17:42:52 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2021-07-16 17:42:53 -0700 |
| commit | bd4232fac3319890429ec303e2f7c3d287c8eaa3 (patch) | |
| tree | b5032aca9cdafb5812801f2868cabddc23e2052a /dir.c | |
| parent | 832a239b72779e97b09943d77b9097ed8376e18e (diff) | |
| parent | bc40dfb10a06612813a3f9b733d65af0732208b2 (diff) | |
| download | git-bd4232fac3319890429ec303e2f7c3d287c8eaa3.tar.gz git-bd4232fac3319890429ec303e2f7c3d287c8eaa3.zip | |
Merge branch 'ab/struct-init'
Code cleanup around struct_type_init() functions.
* ab/struct-init:
string-list.h users: change to use *_{nodup,dup}()
string-list.[ch]: add a string_list_init_{nodup,dup}()
dir.[ch]: replace dir_init() with DIR_INIT
*.c *_init(): define in terms of corresponding *_INIT macro
*.h: move some *_INIT to designated initializers
Diffstat (limited to 'dir.c')
| -rw-r--r-- | dir.c | 9 |
1 files changed, 2 insertions, 7 deletions
@@ -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 { |
