| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v7 3/5] efi/boot.c: wrap PrintStr/PrintErr to allow const CHAR16* arguments
 On 29.09.2020 20:17, Trammell Hudson wrote:
> This patch wraps the EFI OutputString() method so that they can be
> called with const arguments.  The OutputString method does not modify
> its argument, although the prototype is missing const, so it is necssary
> to cast away the const when calling it.
> 
> Signed-off-by: Trammell Hudson <hudson@xxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
with ...
> --- a/xen/common/efi/boot.c
> +++ b/xen/common/efi/boot.c
> @@ -151,10 +151,16 @@ static struct file __initdata cfg;
>  static struct file __initdata kernel;
>  static struct file __initdata ramdisk;
>  static struct file __initdata xsm;
> -static CHAR16 __initdata newline[] = L"\r\n";
> +static const CHAR16 __initconst newline[] = L"\r\n";
>  
> -#define PrintStr(s) StdOut->OutputString(StdOut, s)
> -#define PrintErr(s) StdErr->OutputString(StdErr, s)
> +static void __init PrintStr(const CHAR16 *s)
> +{
> +    StdOut->OutputString(StdOut, (CHAR16 *)s );
> +}
> +static void __init PrintErr(const CHAR16 *s)
... a blank line added here and ...
> @@ -275,7 +281,7 @@ static bool __init match_guid(const EFI_GUID *guid1, 
> const EFI_GUID *guid2)
>  void __init noreturn blexit(const CHAR16 *str)
>  {
>      if ( str )
> -        PrintStr((CHAR16 *)str);
> +        PrintStr(str);
... the similar change to PrintErrMesg() also made. I'll be happy
to do both while committing.
Jan
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |