aboutsummaryrefslogtreecommitdiff
path: root/pathspec.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-01-21 17:21:58 -0800
committerJunio C Hamano <gitster@pobox.com>2023-01-21 17:21:58 -0800
commit60ce816cb637f8fac5e8e5b8a53dff8707b2c04c (patch)
tree54c95811c38748e928c7e788812844d85e8a059d /pathspec.c
parent90c47b3fbabd6ffecfd234911841892b562cfe9e (diff)
parent6e578410960d9ceb35ec98ad4b6fc711f1a9c85c (diff)
downloadgit-60ce816cb637f8fac5e8e5b8a53dff8707b2c04c.tar.xz
Merge branch 'rs/dup-array'
Code cleaning. * rs/dup-array: use DUP_ARRAY add DUP_ARRAY do full type check in BARF_UNLESS_COPYABLE factor out BARF_UNLESS_COPYABLE mingw: make argv2 in try_shell_exec() non-const
Diffstat (limited to 'pathspec.c')
-rw-r--r--pathspec.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/pathspec.c b/pathspec.c
index 46e77a85fe..e038481dc4 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -681,8 +681,7 @@ void copy_pathspec(struct pathspec *dst, const struct pathspec *src)
int i, j;
*dst = *src;
- ALLOC_ARRAY(dst->items, dst->nr);
- COPY_ARRAY(dst->items, src->items, dst->nr);
+ DUP_ARRAY(dst->items, src->items, dst->nr);
for (i = 0; i < dst->nr; i++) {
struct pathspec_item *d = &dst->items[i];
@@ -691,8 +690,7 @@ void copy_pathspec(struct pathspec *dst, const struct pathspec *src)
d->match = xstrdup(s->match);
d->original = xstrdup(s->original);
- ALLOC_ARRAY(d->attr_match, d->attr_match_nr);
- COPY_ARRAY(d->attr_match, s->attr_match, d->attr_match_nr);
+ DUP_ARRAY(d->attr_match, s->attr_match, d->attr_match_nr);
for (j = 0; j < d->attr_match_nr; j++) {
const char *value = s->attr_match[j].value;
d->attr_match[j].value = xstrdup_or_null(value);