aboutsummaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
Diffstat (limited to 'time')
-rw-r--r--time/strftime.c14
-rw-r--r--time/tzfile.c11
2 files changed, 15 insertions, 10 deletions
diff --git a/time/strftime.c b/time/strftime.c
index fdf0500..8d94dcd 100644
--- a/time/strftime.c
+++ b/time/strftime.c
@@ -89,6 +89,14 @@ extern char *tzname[];
# endif
#endif
+#ifdef _LIBC
+# define MEMPCPY(d, s, n) __mempcpy (d, s, n)
+#else
+# ifndef HAVE_MEMPCPY
+# define MEMPCPY(d, s, n) ((void *) ((char *) memcpy (d, s, n) + (n)))
+# endif
+#endif
+
#ifndef __P
# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
# define __P(args) args
@@ -194,8 +202,7 @@ static const char zeroes[16] = /* "0000000000000000" */
do \
{ \
int _this = _len > 16 ? 16 : _len; \
- memcpy ((P), spaces, _this); \
- (P) += _this; \
+ (P) = mempcpy ((P), spaces, _this); \
_len -= _this; \
} \
while (_len > 0); \
@@ -208,8 +215,7 @@ static const char zeroes[16] = /* "0000000000000000" */
do \
{ \
int _this = _len > 16 ? 16 : _len; \
- memcpy ((P), zeroes, _this); \
- (P) += _this; \
+ (P) = mempcpy ((P), zeroes, _this); \
_len -= _this; \
} \
while (_len > 0); \
diff --git a/time/tzfile.c b/time/tzfile.c
index e3cb299..3d2d3e0 100644
--- a/time/tzfile.c
+++ b/time/tzfile.c
@@ -134,7 +134,7 @@ __tzfile_read (const char *file)
{
const char *tzdir;
unsigned int len, tzdir_len;
- char *new;
+ char *new, *tmp;
tzdir = __secure_getenv ("TZDIR");
if (tzdir == NULL || *tzdir == '\0')
@@ -146,9 +146,9 @@ __tzfile_read (const char *file)
tzdir_len = strlen (tzdir);
len = strlen (file) + 1;
new = (char *) __alloca (tzdir_len + 1 + len);
- memcpy (new, tzdir, tzdir_len);
- new[tzdir_len] = '/';
- memcpy (&new[tzdir_len + 1], file, len);
+ tmp = __mempcpy (new, tzdir, tzdir_len);
+ *tmp++ = '/';
+ __mempcpy (tmp, file, len);
file = new;
}
@@ -316,8 +316,7 @@ __tzfile_default (const char *std, const char *dst,
__use_tzfile = 0;
return;
}
- memcpy (zone_names, std, stdlen);
- memcpy (&zone_names[stdlen], dst, dstlen);
+ __mempcpy (__mempcpy (zone_names, std, stdlen), dst, dstlen);
/* Find the standard and daylight time offsets used by the rule file.
We choose the offsets in the types of each flavor that are