Prefer memcpy to strncpy if either will do

strncpy is trickier and a bit slower.
* src/function.c (func_realpath, func_abspath):
* src/misc.c (xstrndup):
Prefer memcpy or mempcpy to strncpy when the source length is known.
diff --git a/src/function.c b/src/function.c
index bf4f2ab..133e33a 100644
--- a/src/function.c
+++ b/src/function.c
@@ -2109,7 +2109,7 @@
           apath[3] = '/';
           dest++;
           root_len++;
-          /* strncpy above copied one character too many.  */
+          /* memcpy above copied one character too many.  */
           name--;
         }
       else
@@ -2178,13 +2178,13 @@
     {
       if (len < GET_PATH_MAX)
         {
-          char *rp;
+          char *rp, *inend;
           struct stat st;
           PATH_VAR (in);
           PATH_VAR (out);
 
-          strncpy (in, path, len);
-          in[len] = '\0';
+          inend = mempcpy (in, path, len);
+          *inend = '\0';
 
 #ifdef HAVE_REALPATH
           ENULLLOOP (rp, realpath (in, out));
@@ -2353,9 +2353,9 @@
         {
           PATH_VAR (in);
           PATH_VAR (out);
+          char *inend = mempcpy (in, path, len);
 
-          strncpy (in, path, len);
-          in[len] = '\0';
+          *inend = '\0';
 
           if (abspath (in, out))
             {
diff --git a/src/misc.c b/src/misc.c
index 9e41a54..b36248f 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -351,7 +351,7 @@
 #else
   result = xmalloc (length + 1);
   if (length > 0)
-    strncpy (result, str, length);
+    memcpy (result, str, length);
   result[length] = '\0';
 #endif