dir.c: rename free_excludes() to clear_exclude_list()
authorAdam Spiers <git@adamspiers.org>
Thu, 27 Dec 2012 02:32:29 +0000 (02:32 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 28 Dec 2012 20:07:47 +0000 (12:07 -0800)
It is clearer to use a 'clear_' prefix for functions which empty
and deallocate the contents of a data structure without freeing
the structure itself, and a 'free_' prefix for functions which
also free the structure itself.

http://article.gmane.org/gmane.comp.version-control.git/206128

Signed-off-by: Adam Spiers <git@adamspiers.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
dir.c
dir.h
unpack-trees.c
diff --git a/dir.c b/dir.c
index 16e10b0d148414e3d0a407a3700ac68a6ae1dd0c..41f141c8d6df61b4d4f2592f1dbde4f26cb43c93 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -400,7 +400,11 @@ static void *read_skip_worktree_file_from_index(const char *path, size_t *size)
        return data;
 }
 
-void free_excludes(struct exclude_list *el)
+/*
+ * Frees memory within el which was allocated for exclude patterns and
+ * the file buffer.  Does not free el itself.
+ */
+void clear_exclude_list(struct exclude_list *el)
 {
        int i;
 
diff --git a/dir.h b/dir.h
index dcb1ad3d3ad47e8c989d06d6873ad412be94e164..5664ba8c6401e40f002385bdaf9aed9b4856a443 100644 (file)
--- a/dir.h
+++ b/dir.h
@@ -135,7 +135,7 @@ extern void add_excludes_from_file(struct dir_struct *, const char *fname);
 extern void parse_exclude_pattern(const char **string, int *patternlen, int *flags, int *nowildcardlen);
 extern void add_exclude(const char *string, const char *base,
                        int baselen, struct exclude_list *el);
-extern void free_excludes(struct exclude_list *el);
+extern void clear_exclude_list(struct exclude_list *el);
 extern int file_exists(const char *);
 
 extern int is_inside_dir(const char *dir);
index c0da0942855c14b9b089a48d568c6852c65c6325..ad621d95e9f14bac3aca2c2d247bc92a98054684 100644 (file)
@@ -1153,7 +1153,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
                *o->dst_index = o->result;
 
 done:
-       free_excludes(&el);
+       clear_exclude_list(&el);
        if (o->path_exclude_check) {
                path_exclude_check_clear(o->path_exclude_check);
                free(o->path_exclude_check);