summaryrefslogtreecommitdiff
path: root/src/file.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2022-07-09 13:26:30 -0400
committerPaul Smith <psmith@gnu.org>2022-07-30 18:40:21 -0400
commit2fe96e4a410c346483a20376e58c40e63887d652 (patch)
tree717a2f61cedcebab86b070fb1fb8c743069d8387 /src/file.c
parentdd24a4c1cfa7b6928ddb2bcd00a023f23aaaf440 (diff)
downloadmake-git-2fe96e4a410c346483a20376e58c40e63887d652.tar.gz
Take advantage of mempcpy() and stpcpy()
* src/makeint.h (stpcpy): Add missing declaration. * src/amiga.c (MyExecute): Avoid extra strlen using stpcpy. * src/function.c (func_shell_base): Ditto. (func_error): Use memcpy() not strcpy() when we know the length. * src/job.c (construct_command_argv_internal): Use stpcpy(). * src/main.c (main): Ditto. (define_makeflags): Ditto. * src/variable.c (print_target_variables): Use memcpy() when we know the length. * src/commands.c (set_file_variables): Use mempcpy(). * src/expand.c (variable_buffer_output): Ditto. * src/file.c (expand_deps): Ditto. * src/function.c (abspath): Ditto. (handle_function): Ditto. * src/implicit.c (pattern_search): Ditto. * src/job.c (construct_command_argv_internal): Use mempcpy() and don't add multiple spaces when there are no shell flags. * src/main.c (decode_env_switches): Use mempcpy() to simplify. (define_makeflags): Ditto. * src/variable.c (selective_vpath_search): Ditto.
Diffstat (limited to 'src/file.c')
-rw-r--r--src/file.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/file.c b/src/file.c
index ab46c4a1..3960cdab 100644
--- a/src/file.c
+++ b/src/file.c
@@ -620,8 +620,7 @@ expand_deps (struct file *f)
while (cs)
{
- memcpy (s, pcs, cs - pcs);
- s += cs - pcs;
+ s = mempcpy (s, pcs, cs - pcs);
*(s++) = '$';
*(s++) = '*';
pcs = ++cs;
@@ -1273,8 +1272,7 @@ build_target_list (char *value)
p = &value[off];
}
- memcpy (p, f->name, l);
- p += l;
+ p = mempcpy (p, f->name, l);
*(p++) = ' ';
}
*(p-1) = '\0';