pathspec: rename free_pathspec() to clear_pathspec()
The function takes a pointer to a pathspec structure, and releases the resources held by it, but does not free() the structure itself. Such a function should be called "clear", not "free". Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jun 2, 2016 at 14:09 UTC
ed6e8038f98e7f15e571a9a291ee4acf438b4dc5
10 files changed
+15
-15
archive.c
+1
-1
@@ -322,7 +322,7 @@ static int path_exists(struct tree *tree, const char *path)
322
pathspec.recursive = 1;
323
ret = read_tree_recursive(tree, "", 0, 0, &pathspec,
324
reject_entry, &pathspec);
325
- free_pathspec(&pathspec);
325
+ clear_pathspec(&pathspec);
326
return ret != 0;
327
}
328
builtin/blame.c
+3
-3
@@ -609,7 +609,7 @@ static struct origin *find_origin(struct scoreboard *sb,
609
}
610
}
611
diff_flush(&diff_opts);
612
- free_pathspec(&diff_opts.pathspec);
612
+ clear_pathspec(&diff_opts.pathspec);
613
return porigin;
614
}
615
@@ -651,7 +651,7 @@ static struct origin *find_rename(struct scoreboard *sb,
651
}
652
}
653
diff_flush(&diff_opts);
654
- free_pathspec(&diff_opts.pathspec);
654
+ clear_pathspec(&diff_opts.pathspec);
655
return porigin;
656
}
657
@@ -1343,7 +1343,7 @@ static void find_copy_in_parent(struct scoreboard *sb,
1343
} while (unblamed);
1344
target->suspects = reverse_blame(leftover, NULL);
1345
diff_flush(&diff_opts);
1346
- free_pathspec(&diff_opts.pathspec);
1346
+ clear_pathspec(&diff_opts.pathspec);
1347
}
1348
1349
/*
builtin/reset.c
+1
-1
@@ -158,7 +158,7 @@ static int read_from_tree(const struct pathspec *pathspec,
158
return 1;
159
diffcore_std(&opt);
160
diff_flush(&opt);
161
- free_pathspec(&opt.pathspec);
161
+ clear_pathspec(&opt.pathspec);
162
163
return 0;
164
}
builtin/update-index.c
+1
-1
@@ -759,7 +759,7 @@ static int do_reupdate(int ac, const char **av,
759
if (save_nr != active_nr)
760
goto redo;
761
}
762
- free_pathspec(&pathspec);
762
+ clear_pathspec(&pathspec);
763
return 0;
764
}
765
combine-diff.c
+1
-1
@@ -1525,7 +1525,7 @@ void diff_tree_combined(const unsigned char *sha1,
1525
free(tmp);
1526
}
1527
1528
- free_pathspec(&diffopts.pathspec);
1528
+ clear_pathspec(&diffopts.pathspec);
1529
}
1530
1531
void diff_tree_combined_merge(const struct commit *commit, int dense,
notes-merge.c
+2
-2
@@ -170,7 +170,7 @@ static struct notes_merge_pair *diff_tree_remote(struct notes_merge_options *o,
170
sha1_to_hex(mp->remote));
171
}
172
diff_flush(&opt);
173
- free_pathspec(&opt.pathspec);
173
+ clear_pathspec(&opt.pathspec);
174
175
*num_changes = len;
176
return changes;
@@ -256,7 +256,7 @@ static void diff_tree_local(struct notes_merge_options *o,
256
sha1_to_hex(mp->local));
257
}
258
diff_flush(&opt);
259
- free_pathspec(&opt.pathspec);
259
+ clear_pathspec(&opt.pathspec);
260
}
261
262
static void check_notes_merge_worktree(struct notes_merge_options *o)
pathspec.c
+1
-1
@@ -489,7 +489,7 @@ void copy_pathspec(struct pathspec *dst, const struct pathspec *src)
489
sizeof(struct pathspec_item) * dst->nr);
490
}
491
492
-void free_pathspec(struct pathspec *pathspec)
492
+void clear_pathspec(struct pathspec *pathspec)
493
{
494
free(pathspec->items);
495
pathspec->items = NULL;
pathspec.h
+2
-2
@@ -19,7 +19,7 @@
19
#define PATHSPEC_ONESTAR 1 /* the pathspec pattern satisfies GFNM_ONESTAR */
20
21
struct pathspec {
22
- const char **_raw; /* get_pathspec() result, not freed by free_pathspec() */
22
+ const char **_raw; /* get_pathspec() result, not freed by clear_pathspec() */
23
int nr;
24
unsigned int has_wildcard:1;
25
unsigned int recursive:1;
@@ -74,7 +74,7 @@ extern void parse_pathspec(struct pathspec *pathspec,
74
const char *prefix,
75
const char **args);
76
extern void copy_pathspec(struct pathspec *dst, const struct pathspec *src);
77
-extern void free_pathspec(struct pathspec *);
77
+extern void clear_pathspec(struct pathspec *);
78
79
static inline int ps_strncmp(const struct pathspec_item *item,
80
const char *s1, const char *s2, size_t n)
revision.c
+1
-1
@@ -1425,7 +1425,7 @@ static void prepare_show_merge(struct rev_info *revs)
1425
ce_same_name(ce, active_cache[i+1]))
1426
i++;
1427
}
1428
- free_pathspec(&revs->prune_data);
1428
+ clear_pathspec(&revs->prune_data);
1429
parse_pathspec(&revs->prune_data, PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
1430
PATHSPEC_PREFER_FULL | PATHSPEC_LITERAL_PATH, "", prune);
1431
revs->limited = 1;
tree-diff.c
+2
-2
@@ -607,7 +607,7 @@ static void try_to_follow_renames(const unsigned char *old, const unsigned char
607
diff_setup_done(&diff_opts);
608
ll_diff_tree_sha1(old, new, base, &diff_opts);
609
diffcore_std(&diff_opts);
610
- free_pathspec(&diff_opts.pathspec);
610
+ clear_pathspec(&diff_opts.pathspec);
611
612
/* Go through the new set of filepairing, and see if we find a more interesting one */
613
opt->found_follow = 0;
@@ -630,7 +630,7 @@ static void try_to_follow_renames(const unsigned char *old, const unsigned char
630
/* Update the path we use from now on.. */
631
path[0] = p->one->path;
632
path[1] = NULL;
633
- free_pathspec(&opt->pathspec);
633
+ clear_pathspec(&opt->pathspec);
634
parse_pathspec(&opt->pathspec,
635
PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
636
PATHSPEC_LITERAL_PATH, "", path);