Patchwork [prefix.c] : 4 of 7 Fix of PR target/53912 bootstrap fails using default c++ mode in stage 2 and 3 for native x86_64-w64-mingw32

login
register
mail settings
Submitter Kai Tietz
Date Nov. 29, 2012, 12:09 p.m.
Message ID <CAEwic4Zz43j6U90a_bBks7P1-79Yu3PqyxxRqF2tVQzK5LRVvw@mail.gmail.com>
Download mbox | patch
Permalink /patch/202725/
State New
Headers show

Comments

Kai Tietz - Nov. 29, 2012, 12:09 p.m.
Hello,

this trivial patch fixes a bootstrap issue on LLP64 hosts.

ChangeLog

2012-11-29 Kai Tietz

	PR target/53912
	* prefix.c (lookup_key): Explicit cast return-type of xmalloc/xrealloc
	to char *.

Tested for i686-w64-mingw32, x86_64-w64-mingw32, and
x86_64-unknown-gnu-linux. Ok for apply?

Regards,
Kai
Ian Taylor - Nov. 29, 2012, 6:18 p.m.
On Thu, Nov 29, 2012 at 4:09 AM, Kai Tietz <ktietz70@googlemail.com> wrote:
>
> ChangeLog
>
> 2012-11-29 Kai Tietz
>
>         PR target/53912
>         * prefix.c (lookup_key): Explicit cast return-type of xmalloc/xrealloc
>         to char *.
>
> Tested for i686-w64-mingw32, x86_64-w64-mingw32, and
> x86_64-unknown-gnu-linux. Ok for apply?
>
> Regards,
> Kai
>
> Index: prefix.c
> ===================================================================
> --- prefix.c    (Revision 193925)
> +++ prefix.c    (Arbeitskopie)
> @@ -157,12 +157,12 @@ lookup_key (char *key)
>      }
>
>    size = 32;
> -  dst = xmalloc (size);
> +  dst = (char *) xmalloc (size);
>
>    res = RegQueryValueExA (reg_key, key, 0, &type, (LPBYTE) dst, &size);
>    if (res == ERROR_MORE_DATA && type == REG_SZ)
>      {
> -      dst = xrealloc (dst, size);
> +      dst = (char *) xrealloc (dst, size);
>        res = RegQueryValueExA (reg_key, key, 0, &type, (LPBYTE) dst, &size);
>      }


This code should be using the XNEWVEC and XRESIZEVEC macros.

Ian

Patch

Index: prefix.c
===================================================================
--- prefix.c    (Revision 193925)
+++ prefix.c    (Arbeitskopie)
@@ -157,12 +157,12 @@  lookup_key (char *key)
     }

   size = 32;
-  dst = xmalloc (size);
+  dst = (char *) xmalloc (size);

   res = RegQueryValueExA (reg_key, key, 0, &type, (LPBYTE) dst, &size);
   if (res == ERROR_MORE_DATA && type == REG_SZ)
     {
-      dst = xrealloc (dst, size);
+      dst = (char *) xrealloc (dst, size);
       res = RegQueryValueExA (reg_key, key, 0, &type, (LPBYTE) dst, &size);
     }