maint: s/strncpy/memcpy/, when equivalent

* src/output.c (output_skeleton): Use memcpy, not strncpy,
since the source is known to fit in the destination buffer.
* src/parse-gram.y (%skeleton): Likewise.
This commit is contained in:
Jim Meyering
2012-05-05 11:30:01 +02:00
parent 7020e5f050
commit bb3b912b0a
2 changed files with 2 additions and 2 deletions

View File

@@ -512,7 +512,7 @@ output_skeleton (void)
full_skeleton = xmalloc (pkgdatadirlen + 1
+ (skeleton_size < sizeof m4sugar
? sizeof m4sugar : skeleton_size));
strncpy (full_skeleton, pkgdatadir, pkgdatadirlen);
memcpy (full_skeleton, pkgdatadir, pkgdatadirlen);
full_skeleton[pkgdatadirlen] = '/';
strcpy (full_skeleton + pkgdatadirlen + 1, m4sugar);
full_m4sugar = xstrdup (full_skeleton);

View File

@@ -322,7 +322,7 @@ prologue_declaration:
xmalloc (dir_length + 1 + strlen (skeleton_user) + 1);
if (dir_length > 0)
{
strncpy (skeleton_build, current_file, dir_length);
memcpy (skeleton_build, current_file, dir_length);
skeleton_build[dir_length++] = '/';
}
strcpy (skeleton_build + dir_length, skeleton_user);