[PATCH 07/17] mv: small code cleanup
- From
- Brandon Williams <bmwill@google.com>
- Date
- Dec 6, 2016, 21:51 UTC
- Message-ID
- <1481061106-117775-8-git-send-email-bmwill@google.com>
- In-Reply-To
- <1481061106-117775-1-git-send-email-bmwill@google.com>
Now that the call to 'parse_pathspec()' doesn't modify the passed in const char **array there isn't a need to duplicate the pathspec element prior to freeing the intermediate strings. This small cleanup just makes the code a bit easier to read.
Signed-off-by: Brandon Williams <bmwill@google.com> --- builtin/mv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/builtin/mv.c b/builtin/mv.c index 4df4a12..b7cceb6 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -56,9 +56,8 @@ static const char **internal_copy_pathspec(const char *prefix, /* Copy the pathspec and free the old intermediate strings */ for (i = 0; i < count; i++) { - const char *match = xstrdup(ps.items[i].match); free((char *) result[i]); - result[i] = match; + result[i] = xstrdup(ps.items[i].match); } clear_pathspec(&ps);
-- 2.8.0.rc3.226.g39d4020