Skip to content

Commit f619881

Browse files
aspiersgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a35341a commit f619881

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

dir.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,11 @@ static void *read_skip_worktree_file_from_index(const char *path, size_t *size)
400400
return data;
401401
}
402402

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)
404408
{
405409
int i;
406410

dir.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ extern void add_excludes_from_file(struct dir_struct *, const char *fname);
135135
extern void parse_exclude_pattern(const char **string, int *patternlen, int *flags, int *nowildcardlen);
136136
extern void add_exclude(const char *string, const char *base,
137137
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);
139139
extern int file_exists(const char *);
140140

141141
extern int is_inside_dir(const char *dir);

unpack-trees.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
11531153
*o->dst_index = o->result;
11541154

11551155
done:
1156-
free_excludes(&el);
1156+
clear_exclude_list(&el);
11571157
if (o->path_exclude_check) {
11581158
path_exclude_check_clear(o->path_exclude_check);
11591159
free(o->path_exclude_check);

0 commit comments

Comments
 (0)