pathspec: rename free_pathspec() to clear_pathspec()
authorJunio C Hamano <gitster@pobox.com>
Thu, 2 Jun 2016 21:09:22 +0000 (14:09 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 Jun 2016 21:09:22 +0000 (14:09 -0700)
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>
archive.c
builtin/blame.c
builtin/reset.c
builtin/update-index.c
combine-diff.c
notes-merge.c
pathspec.c
pathspec.h
revision.c
tree-diff.c
index 5d735ae6039f0d9708d61a27a490953ff27badf5..42df9748d668744c213e8eba0ae4b710829e1cfe 100644 (file)
--- a/archive.c
+++ b/archive.c
@@ -322,7 +322,7 @@ static int path_exists(struct tree *tree, const char *path)
        pathspec.recursive = 1;
        ret = read_tree_recursive(tree, "", 0, 0, &pathspec,
                                  reject_entry, &pathspec);
-       free_pathspec(&pathspec);
+       clear_pathspec(&pathspec);
        return ret != 0;
 }
 
index 21f42b0b62b81b637f1cc9589cd6c0306a93d05e..759d84affb2af532efb5c652f354b4dd26e9c384 100644 (file)
@@ -609,7 +609,7 @@ static struct origin *find_origin(struct scoreboard *sb,
                }
        }
        diff_flush(&diff_opts);
-       free_pathspec(&diff_opts.pathspec);
+       clear_pathspec(&diff_opts.pathspec);
        return porigin;
 }
 
@@ -651,7 +651,7 @@ static struct origin *find_rename(struct scoreboard *sb,
                }
        }
        diff_flush(&diff_opts);
-       free_pathspec(&diff_opts.pathspec);
+       clear_pathspec(&diff_opts.pathspec);
        return porigin;
 }
 
@@ -1343,7 +1343,7 @@ static void find_copy_in_parent(struct scoreboard *sb,
        } while (unblamed);
        target->suspects = reverse_blame(leftover, NULL);
        diff_flush(&diff_opts);
-       free_pathspec(&diff_opts.pathspec);
+       clear_pathspec(&diff_opts.pathspec);
 }
 
 /*
index 092c3a5399c731e83058233f8e3e459be493e140..acd6278868b65981fd838b4ade327cdcaab51ccd 100644 (file)
@@ -158,7 +158,7 @@ static int read_from_tree(const struct pathspec *pathspec,
                return 1;
        diffcore_std(&opt);
        diff_flush(&opt);
-       free_pathspec(&opt.pathspec);
+       clear_pathspec(&opt.pathspec);
 
        return 0;
 }
index b8b8522249337703eb66b245ad263e7dc1b41582..6cdfd5f7308df9df10afd90748a83d7abb61ca65 100644 (file)
@@ -759,7 +759,7 @@ static int do_reupdate(int ac, const char **av,
                if (save_nr != active_nr)
                        goto redo;
        }
-       free_pathspec(&pathspec);
+       clear_pathspec(&pathspec);
        return 0;
 }
 
index 8f2313d5022326dc244fa8eba4a8640299ebeac8..5920df8b8dd12ff382131a6753f40bbdec64fd37 100644 (file)
@@ -1525,7 +1525,7 @@ void diff_tree_combined(const unsigned char *sha1,
                free(tmp);
        }
 
-       free_pathspec(&diffopts.pathspec);
+       clear_pathspec(&diffopts.pathspec);
 }
 
 void diff_tree_combined_merge(const struct commit *commit, int dense,
index 34bfac0c685f18c635b30dbf19d7b25250faa1c6..b7814c9b6488825a68bf8ca20de2c6420f01e26b 100644 (file)
@@ -170,7 +170,7 @@ static struct notes_merge_pair *diff_tree_remote(struct notes_merge_options *o,
                       sha1_to_hex(mp->remote));
        }
        diff_flush(&opt);
-       free_pathspec(&opt.pathspec);
+       clear_pathspec(&opt.pathspec);
 
        *num_changes = len;
        return changes;
@@ -256,7 +256,7 @@ static void diff_tree_local(struct notes_merge_options *o,
                       sha1_to_hex(mp->local));
        }
        diff_flush(&opt);
-       free_pathspec(&opt.pathspec);
+       clear_pathspec(&opt.pathspec);
 }
 
 static void check_notes_merge_worktree(struct notes_merge_options *o)
index c9e9b6c0778c755fcade1430cf674dfd867050f1..24e0dd52322baf4a507765ae0948c98f0ec30602 100644 (file)
@@ -489,7 +489,7 @@ void copy_pathspec(struct pathspec *dst, const struct pathspec *src)
               sizeof(struct pathspec_item) * dst->nr);
 }
 
-void free_pathspec(struct pathspec *pathspec)
+void clear_pathspec(struct pathspec *pathspec)
 {
        free(pathspec->items);
        pathspec->items = NULL;
index 0c1126264a394e62cfbed47b2feae85e9b5d1410..4a80f6fc96a572681acd8aa8349b2c0b1237f9f1 100644 (file)
@@ -19,7 +19,7 @@
 #define PATHSPEC_ONESTAR 1     /* the pathspec pattern satisfies GFNM_ONESTAR */
 
 struct pathspec {
-       const char **_raw; /* get_pathspec() result, not freed by free_pathspec() */
+       const char **_raw; /* get_pathspec() result, not freed by clear_pathspec() */
        int nr;
        unsigned int has_wildcard:1;
        unsigned int recursive:1;
@@ -74,7 +74,7 @@ extern void parse_pathspec(struct pathspec *pathspec,
                           const char *prefix,
                           const char **args);
 extern void copy_pathspec(struct pathspec *dst, const struct pathspec *src);
-extern void free_pathspec(struct pathspec *);
+extern void clear_pathspec(struct pathspec *);
 
 static inline int ps_strncmp(const struct pathspec_item *item,
                             const char *s1, const char *s2, size_t n)
index d30d1c4f802c77a47df0078f49247457bf22c1a3..2f60062876237b4ac39b568af1a81294bf529793 100644 (file)
@@ -1425,7 +1425,7 @@ static void prepare_show_merge(struct rev_info *revs)
                       ce_same_name(ce, active_cache[i+1]))
                        i++;
        }
-       free_pathspec(&revs->prune_data);
+       clear_pathspec(&revs->prune_data);
        parse_pathspec(&revs->prune_data, PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
                       PATHSPEC_PREFER_FULL | PATHSPEC_LITERAL_PATH, "", prune);
        revs->limited = 1;
index ff4e0d3cb60b51080d2f6100e38d1476e6eb6dcf..edb4de9b723a5f3c8625d41f1d8595cd1e37d8ac 100644 (file)
@@ -607,7 +607,7 @@ static void try_to_follow_renames(const unsigned char *old, const unsigned char
        diff_setup_done(&diff_opts);
        ll_diff_tree_sha1(old, new, base, &diff_opts);
        diffcore_std(&diff_opts);
-       free_pathspec(&diff_opts.pathspec);
+       clear_pathspec(&diff_opts.pathspec);
 
        /* Go through the new set of filepairing, and see if we find a more interesting one */
        opt->found_follow = 0;
@@ -630,7 +630,7 @@ static void try_to_follow_renames(const unsigned char *old, const unsigned char
                        /* Update the path we use from now on.. */
                        path[0] = p->one->path;
                        path[1] = NULL;
-                       free_pathspec(&opt->pathspec);
+                       clear_pathspec(&opt->pathspec);
                        parse_pathspec(&opt->pathspec,
                                       PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
                                       PATHSPEC_LITERAL_PATH, "", path);