dir.c: rename free_excludes() to clear_exclude_list()
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>
Adam Spiers committed
Dec 27, 2012 at 02:32 UTC
f61988125130ac091bfb69bda5d62b0ad8f054c4
3 files changed
+7
-3
dir.c
+5
-1
@@ -400,7 +400,11 @@ static void *read_skip_worktree_file_from_index(const char *path, size_t *size)
400
return data;
401
}
402
403
-void free_excludes(struct exclude_list *el)
403
+/*
404
+ * Frees memory within el which was allocated for exclude patterns and
405
+ * the file buffer. Does not free el itself.
406
+ */
407
+void clear_exclude_list(struct exclude_list *el)
408
{
409
int i;
410
dir.h
+1
-1
@@ -135,7 +135,7 @@ extern void add_excludes_from_file(struct dir_struct *, const char *fname);
135
extern void parse_exclude_pattern(const char **string, int *patternlen, int *flags, int *nowildcardlen);
136
extern void add_exclude(const char *string, const char *base,
137
int baselen, struct exclude_list *el);
138
-extern void free_excludes(struct exclude_list *el);
138
+extern void clear_exclude_list(struct exclude_list *el);
139
extern int file_exists(const char *);
140
141
extern int is_inside_dir(const char *dir);
unpack-trees.c
+1
-1
@@ -1153,7 +1153,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
1153
*o->dst_index = o->result;
1154
1155
done:
1156
- free_excludes(&el);
1156
+ clear_exclude_list(&el);
1157
if (o->path_exclude_check) {
1158
path_exclude_check_clear(o->path_exclude_check);
1159
free(o->path_exclude_check);