mirror of
https://github.com/UberGames/ioef.git
synced 2024-11-24 05:01:40 +00:00
Fix memmove()
[The lcc source] overrides the libc memmove() with its own implementation, but that implementation fails to follow the specification. In particular, it returns NULL rather than memmove()'s first parameter. GCC now optimizes based on this aspect of the specification, so things go wrong at runtime. [Text & patch from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56881#c8]
This commit is contained in:
parent
6983187a99
commit
1c66e30e7e
1 changed files with 2 additions and 2 deletions
|
@ -109,7 +109,7 @@ memmove(void *dp, const void *sp, size_t n)
|
||||||
unsigned char *cdp, *csp;
|
unsigned char *cdp, *csp;
|
||||||
|
|
||||||
if (n<=0)
|
if (n<=0)
|
||||||
return 0;
|
return dp;
|
||||||
cdp = dp;
|
cdp = dp;
|
||||||
csp = (unsigned char *)sp;
|
csp = (unsigned char *)sp;
|
||||||
if (cdp < csp) {
|
if (cdp < csp) {
|
||||||
|
@ -123,6 +123,6 @@ memmove(void *dp, const void *sp, size_t n)
|
||||||
*--cdp = *--csp;
|
*--cdp = *--csp;
|
||||||
} while (--n);
|
} while (--n);
|
||||||
}
|
}
|
||||||
return 0;
|
return dp;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue