mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 00:59:15 +08:00
Remove backup ppc struct dis_private.
ppc-dis.c used a global struct whenever malloc failed to provide the eight bytes of memory necessary for struct dis_private. Which is quite ridiculous. If that malloc failed there is zero chance some other malloc won't fail too. * ppc-dis.c (private): Delete variable. (get_powerpc_dialect): Don't segfault on NULL info->private_data. (powerpc_init_dialect): Don't use global private.
This commit is contained in:
@ -1,3 +1,9 @@
|
||||
2019-12-10 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* ppc-dis.c (private): Delete variable.
|
||||
(get_powerpc_dialect): Don't segfault on NULL info->private_data.
|
||||
(powerpc_init_dialect): Don't use global private.
|
||||
|
||||
2019-12-10 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* s12z-opc.c: Formatting.
|
||||
|
@ -40,7 +40,7 @@ struct dis_private
|
||||
{
|
||||
/* Stash the result of parsing disassembler_options here. */
|
||||
ppc_cpu_t dialect;
|
||||
} private;
|
||||
};
|
||||
|
||||
#define POWERPC_DIALECT(INFO) \
|
||||
(((struct dis_private *) ((INFO)->private_data))->dialect)
|
||||
@ -259,7 +259,8 @@ get_powerpc_dialect (struct disassemble_info *info)
|
||||
{
|
||||
ppc_cpu_t dialect = 0;
|
||||
|
||||
dialect = POWERPC_DIALECT (info);
|
||||
if (info->private_data)
|
||||
dialect = POWERPC_DIALECT (info);
|
||||
|
||||
/* Disassemble according to the section headers flags for VLE-mode. */
|
||||
if (dialect & PPC_OPCODE_VLE
|
||||
@ -308,7 +309,7 @@ powerpc_init_dialect (struct disassemble_info *info)
|
||||
struct dis_private *priv = calloc (sizeof (*priv), 1);
|
||||
|
||||
if (priv == NULL)
|
||||
priv = &private;
|
||||
return;
|
||||
|
||||
switch (info->mach)
|
||||
{
|
||||
|
Reference in New Issue
Block a user