summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib-src/getopt.c13
-rw-r--r--src/strftime.c14
2 files changed, 15 insertions, 12 deletions
diff --git a/lib-src/getopt.c b/lib-src/getopt.c
index 570cb9da69e..2d3f3b64bf2 100644
--- a/lib-src/getopt.c
+++ b/lib-src/getopt.c
@@ -331,9 +331,9 @@ exchange (argv)
nonoption_flags_len = nonoption_flags_max_len = 0;
else
{
- memcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len);
- memset (&new_str[nonoption_flags_max_len], '\0',
- top + 1 - nonoption_flags_max_len);
+ memset (__mempcpy (new_str, __getopt_nonoption_flags,
+ nonoption_flags_max_len),
+ '\0', top + 1 - nonoption_flags_max_len);
nonoption_flags_max_len = top + 1;
__getopt_nonoption_flags = new_str;
}
@@ -442,11 +442,8 @@ _getopt_initialize (argc, argv, optstring)
if (__getopt_nonoption_flags == NULL)
nonoption_flags_max_len = -1;
else
- {
- memcpy (__getopt_nonoption_flags, orig_str, len);
- memset (&__getopt_nonoption_flags[len], '\0',
- nonoption_flags_max_len - len);
- }
+ memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
+ '\0', nonoption_flags_max_len - len);
}
}
nonoption_flags_len = nonoption_flags_max_len;
diff --git a/src/strftime.c b/src/strftime.c
index 51dbc389a75..7439244bc4d 100644
--- a/src/strftime.c
+++ b/src/strftime.c
@@ -91,6 +91,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
@@ -196,8 +204,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); \
@@ -210,8 +217,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); \