mirror of https://github.com/ncroxon/gnu-efi
Make CopyMemC call CopyMem
* The last part of this: I hope :) * ISO C permits overwriting of Src even if it marks Src as CONST * UEFI marks Src as NON CONST, so forward calls via this function * Allows us to keep in-line with shim without causing Werror havoc with other downstreams Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
This commit is contained in:
parent
c03d395571
commit
d9b395ac03
|
@ -100,16 +100,11 @@ RtCopyMemC (
|
|||
IN UINTN len
|
||||
)
|
||||
{
|
||||
CHAR8 *d = (CHAR8*)Dest;
|
||||
CONST CHAR8 *s = (CONST CHAR8*)Src;
|
||||
|
||||
if (d == NULL || s == NULL || s == d)
|
||||
return;
|
||||
|
||||
/* CONST Src: UB if Src and Dest overlap */
|
||||
|
||||
while (len--)
|
||||
*d++ = *s++;
|
||||
/* CopyMem matches ISO C apart from the change to NON-CONST Src
|
||||
Overwriting Src is an intended outcome if overlapping occurs (per memmove)
|
||||
This function is useful to avoid GCC dying in changing pointer setup
|
||||
*/
|
||||
RtCopyMem(Dest, (VOID*)Src, len);
|
||||
}
|
||||
|
||||
#ifndef __GNUC__
|
||||
|
|
Loading…
Reference in New Issue