mirror of
https://github.com/fluencelabs/musl
synced 2025-06-12 22:41:37 +00:00
fix backwards conditional in stpncpy
this only made the function unnecessarily slow on systems with unaligned access, but would of course crash on systems that can't do unaligned accesses (none of which have ports yet).
This commit is contained in:
@ -14,7 +14,7 @@ char *__stpncpy(char *d, const char *s, size_t n)
|
|||||||
size_t *wd;
|
size_t *wd;
|
||||||
const size_t *ws;
|
const size_t *ws;
|
||||||
|
|
||||||
if (((uintptr_t)s & ALIGN) != ((uintptr_t)d & ALIGN)) {
|
if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) {
|
||||||
for (; ((uintptr_t)s & ALIGN) && n && (*d=*s); n--, s++, d++);
|
for (; ((uintptr_t)s & ALIGN) && n && (*d=*s); n--, s++, d++);
|
||||||
if (!n || !*s) goto tail;
|
if (!n || !*s) goto tail;
|
||||||
wd=(void *)d; ws=(const void *)s;
|
wd=(void *)d; ws=(const void *)s;
|
||||||
|
Reference in New Issue
Block a user