Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/dir.h
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-07-01 13:51:27 +0300
committerJunio C Hamano <gitster@pobox.com>2021-07-01 22:32:22 +0300
commitce93a4c6127abdf1ad9eacd537edd1c571a18e41 (patch)
treef5393dbc3f3ce9cd98ba2aa5d7f015b1bd796a30 /dir.h
parent5726a6b4012cd41701927a6637b9f2070e7760ee (diff)
dir.[ch]: replace dir_init() with DIR_INIT
Remove the dir_init() function and replace it with a DIR_INIT macro. In many cases in the codebase we need to initialize things with a function for good reasons, e.g. needing to call another function on initialization. The "dir_init()" function was not one such case, and could trivially be replaced with a more idiomatic macro initialization pattern. The only place where we made use of its use of memset() was in dir_clear() itself, which resets the contents of an an existing struct pointer. Let's use the new "memcpy() a 'blank' struct on the stack" idiom to do that reset. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.h')
-rw-r--r--dir.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/dir.h b/dir.h
index e3db9b9ec6..8d0ddd8f18 100644
--- a/dir.h
+++ b/dir.h
@@ -342,6 +342,8 @@ struct dir_struct {
unsigned visited_directories;
};
+#define DIR_INIT { 0 }
+
struct dirent *readdir_skip_dot_and_dotdot(DIR *dirp);
/*Count the number of slashes for string s*/
@@ -367,8 +369,6 @@ int match_pathspec(struct index_state *istate,
int report_path_error(const char *ps_matched, const struct pathspec *pathspec);
int within_depth(const char *name, int namelen, int depth, int max_depth);
-void dir_init(struct dir_struct *dir);
-
int fill_directory(struct dir_struct *dir,
struct index_state *istate,
const struct pathspec *pathspec);