X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstring%2Fstpncpy.c;h=1f57a4ddbd0a818168e56c0b15178e93304c42cf;hb=131276809fe3b7bed6086772bc5e3e9941dc6c6c;hp=473db17e9cd1c6682f0846731684537248864a81;hpb=9f19b3ec8dec1e9402e31172a74b72cd46d3da36;p=musl diff --git a/src/string/stpncpy.c b/src/string/stpncpy.c index 473db17e..1f57a4dd 100644 --- a/src/string/stpncpy.c +++ b/src/string/stpncpy.c @@ -1,5 +1,4 @@ #include -#include #include #include #include "libc.h" @@ -9,7 +8,7 @@ #define HIGHS (ONES * (UCHAR_MAX/2+1)) #define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) -char *__stpncpy(char *d, const char *s, size_t n) +char *__stpncpy(char *restrict d, const char *restrict s, size_t n) { size_t *wd; const size_t *ws; @@ -19,7 +18,7 @@ char *__stpncpy(char *d, const char *s, size_t n) if (!n || !*s) goto tail; wd=(void *)d; ws=(const void *)s; for (; n>=sizeof(size_t) && !HASZERO(*ws); - n-=sizeof(size_t), ws++, *wd++) *wd = *ws; + n-=sizeof(size_t), ws++, wd++) *wd = *ws; d=(void *)wd; s=(const void *)ws; } for (; n && (*d=*s); n--, s++, d++);