diff options
author | delphij <delphij@FreeBSD.org> | 2015-08-11 05:58:33 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2015-08-11 05:58:33 +0000 |
commit | 5b86b1c65a4a5e8eb458221a44ac021a802207d3 (patch) | |
tree | e39f11268c219eca8129ac4e5bd1a5932d7afec5 /usr.bin | |
parent | 8e6b3a8d59587481c485806c69429bede2a88772 (diff) | |
download | FreeBSD-src-5b86b1c65a4a5e8eb458221a44ac021a802207d3.zip FreeBSD-src-5b86b1c65a4a5e8eb458221a44ac021a802207d3.tar.gz |
Use __DECONST instead of doing strdup/free.
Suggested by: ed
MFC after: 2 weeks
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/patch/inp.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c index b05fbe0..f4daeae 100644 --- a/usr.bin/patch/inp.c +++ b/usr.bin/patch/inp.c @@ -219,8 +219,8 @@ plan_a(const char *filename) say("Comparing file %s to default " "RCS version...\n", filename); - argp[0] = strdup(RCSDIFF); - argp[1] = strdup(filename); + argp[0] = __DECONST(char *, RCSDIFF); + argp[1] = __DECONST(char *, filename); posix_spawn_file_actions_init(&file_actions); posix_spawn_file_actions_addopen(&file_actions, STDOUT_FILENO, _PATH_DEVNULL, O_WRONLY, 0); @@ -234,17 +234,15 @@ plan_a(const char *filename) } else fatal("posix_spawn: %s\n", strerror(errno)); posix_spawn_file_actions_destroy(&file_actions); - free(argp[1]); - free(argp[0]); } if (verbose) say("Checking out file %s from RCS...\n", filename); - argp[0] = strdup(CHECKOUT); - argp[1] = strdup("-l"); - argp[2] = strdup(filename); + argp[0] = __DECONST(char *, CHECKOUT); + argp[1] = __DECONST(char *, "-l"); + argp[2] = __DECONST(char *, filename); if (posix_spawn(&pid, CHECKOUT, NULL, NULL, argp, NULL) == 0) { pid = waitpid(pid, &pstat, 0); @@ -254,9 +252,6 @@ plan_a(const char *filename) filename); } else fatal("posix_spawn: %s\n", strerror(errno)); - free(argp[2]); - free(argp[1]); - free(argp[0]); } else if (statfailed) { fatal("can't find %s\n", filename); } |