mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 21:41:47 +08:00
use xstrdup and friends more
gas/ChangeLog: 2016-04-03 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/obj-elf.c (obj_elf_vendor_attribute): Use xstrdup. * config/tc-ppc.c (ppc_frob_file_before_adjust): Likewise. (ppc_znop): Likewise. (ppc_pe_section): Likewise. (ppc_frob_symbol): Likewise. * config/tc-tic30.c (tic30_operand): Likewise. * config/tc-tic4x.c (tic4x_sect): Likewise. (tic4x_usect): Likewise.
This commit is contained in:
@ -1,3 +1,14 @@
|
|||||||
|
2016-04-03 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
|
||||||
|
|
||||||
|
* config/obj-elf.c (obj_elf_vendor_attribute): Use xstrdup.
|
||||||
|
* config/tc-ppc.c (ppc_frob_file_before_adjust): Likewise.
|
||||||
|
(ppc_znop): Likewise.
|
||||||
|
(ppc_pe_section): Likewise.
|
||||||
|
(ppc_frob_symbol): Likewise.
|
||||||
|
* config/tc-tic30.c (tic30_operand): Likewise.
|
||||||
|
* config/tc-tic4x.c (tic4x_sect): Likewise.
|
||||||
|
(tic4x_usect): Likewise.
|
||||||
|
|
||||||
2016-04-03 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
|
2016-04-03 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
|
||||||
|
|
||||||
* config/tc-alpha.c: Const qualify FLT_CHARS.
|
* config/tc-alpha.c: Const qualify FLT_CHARS.
|
||||||
|
@ -1609,9 +1609,7 @@ obj_elf_vendor_attribute (int vendor)
|
|||||||
if (i == 0)
|
if (i == 0)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
name = xmalloc (i + 1);
|
name = xstrndup (s, i);
|
||||||
memcpy (name, s, i);
|
|
||||||
name[i] = '\0';
|
|
||||||
|
|
||||||
#ifndef CONVERT_SYMBOLIC_ATTRIBUTE
|
#ifndef CONVERT_SYMBOLIC_ATTRIBUTE
|
||||||
#define CONVERT_SYMBOLIC_ATTRIBUTE(a) -1
|
#define CONVERT_SYMBOLIC_ATTRIBUTE(a) -1
|
||||||
|
@ -2390,7 +2390,6 @@ ppc_frob_file_before_adjust (void)
|
|||||||
const char *name;
|
const char *name;
|
||||||
char *dotname;
|
char *dotname;
|
||||||
symbolS *dotsym;
|
symbolS *dotsym;
|
||||||
size_t len;
|
|
||||||
|
|
||||||
name = S_GET_NAME (symp);
|
name = S_GET_NAME (symp);
|
||||||
if (name[0] == '.')
|
if (name[0] == '.')
|
||||||
@ -2400,10 +2399,7 @@ ppc_frob_file_before_adjust (void)
|
|||||||
|| S_IS_DEFINED (symp))
|
|| S_IS_DEFINED (symp))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
len = strlen (name) + 1;
|
dotname = concat (".", name, (char *) NULL);
|
||||||
dotname = xmalloc (len + 1);
|
|
||||||
dotname[0] = '.';
|
|
||||||
memcpy (dotname + 1, name, len);
|
|
||||||
dotsym = symbol_find_noref (dotname, 1);
|
dotsym = symbol_find_noref (dotname, 1);
|
||||||
free (dotname);
|
free (dotname);
|
||||||
if (dotsym != NULL && (symbol_used_p (dotsym)
|
if (dotsym != NULL && (symbol_used_p (dotsym)
|
||||||
@ -5195,8 +5191,7 @@ ppc_znop (int ignore ATTRIBUTE_UNUSED)
|
|||||||
/* Strip out the symbol name. */
|
/* Strip out the symbol name. */
|
||||||
c = get_symbol_name (&symbol_name);
|
c = get_symbol_name (&symbol_name);
|
||||||
|
|
||||||
name = xmalloc (input_line_pointer - symbol_name + 1);
|
name = xstrdup (symbol_name);
|
||||||
strcpy (name, symbol_name);
|
|
||||||
|
|
||||||
sym = symbol_find_or_make (name);
|
sym = symbol_find_or_make (name);
|
||||||
|
|
||||||
@ -5370,8 +5365,7 @@ ppc_pe_section (int ignore ATTRIBUTE_UNUSED)
|
|||||||
|
|
||||||
c = get_symbol_name (§ion_name);
|
c = get_symbol_name (§ion_name);
|
||||||
|
|
||||||
name = xmalloc (input_line_pointer - section_name + 1);
|
name = xstrdup (section_name);
|
||||||
strcpy (name, section_name);
|
|
||||||
|
|
||||||
*input_line_pointer = c;
|
*input_line_pointer = c;
|
||||||
|
|
||||||
@ -5768,9 +5762,7 @@ ppc_frob_symbol (symbolS *sym)
|
|||||||
char *snew;
|
char *snew;
|
||||||
|
|
||||||
len = s - name;
|
len = s - name;
|
||||||
snew = xmalloc (len + 1);
|
snew = xstrndup (name, len);
|
||||||
memcpy (snew, name, len);
|
|
||||||
snew[len] = '\0';
|
|
||||||
|
|
||||||
S_SET_NAME (sym, snew);
|
S_SET_NAME (sym, snew);
|
||||||
}
|
}
|
||||||
|
@ -604,9 +604,7 @@ tic30_operand (char *token)
|
|||||||
segT retval;
|
segT retval;
|
||||||
|
|
||||||
debug ("Probably a label: %s\n", token);
|
debug ("Probably a label: %s\n", token);
|
||||||
current_op->immediate.label = malloc (strlen (token) + 1);
|
current_op->immediate.label = xstrdup (token);
|
||||||
strcpy (current_op->immediate.label, token);
|
|
||||||
current_op->immediate.label[strlen (token)] = '\0';
|
|
||||||
save_input_line_pointer = input_line_pointer;
|
save_input_line_pointer = input_line_pointer;
|
||||||
input_line_pointer = token;
|
input_line_pointer = token;
|
||||||
|
|
||||||
@ -634,9 +632,7 @@ tic30_operand (char *token)
|
|||||||
for (count = 0; count < strlen (token); count++)
|
for (count = 0; count < strlen (token); count++)
|
||||||
if (*(token + count) == '.')
|
if (*(token + count) == '.')
|
||||||
current_op->immediate.decimal_found = 1;
|
current_op->immediate.decimal_found = 1;
|
||||||
current_op->immediate.label = malloc (strlen (token) + 1);
|
current_op->immediate.label = xstrdup (token);
|
||||||
strcpy (current_op->immediate.label, token);
|
|
||||||
current_op->immediate.label[strlen (token)] = '\0';
|
|
||||||
current_op->immediate.f_number = (float) atof (token);
|
current_op->immediate.f_number = (float) atof (token);
|
||||||
current_op->immediate.s_number = (int) atoi (token);
|
current_op->immediate.s_number = (int) atoi (token);
|
||||||
current_op->immediate.u_number = (unsigned int) atoi (token);
|
current_op->immediate.u_number = (unsigned int) atoi (token);
|
||||||
|
@ -964,8 +964,7 @@ tic4x_sect (int x ATTRIBUTE_UNUSED)
|
|||||||
if (c == '"')
|
if (c == '"')
|
||||||
c = * ++ input_line_pointer;
|
c = * ++ input_line_pointer;
|
||||||
input_line_pointer++; /* Skip null symbol terminator. */
|
input_line_pointer++; /* Skip null symbol terminator. */
|
||||||
name = xmalloc (input_line_pointer - section_name + 1);
|
name = xstrdup (section_name);
|
||||||
strcpy (name, section_name);
|
|
||||||
|
|
||||||
/* TI C from version 5.0 allows a section name to contain a
|
/* TI C from version 5.0 allows a section name to contain a
|
||||||
subsection name as well. The subsection name is separated by a
|
subsection name as well. The subsection name is separated by a
|
||||||
@ -1075,8 +1074,7 @@ tic4x_usect (int x ATTRIBUTE_UNUSED)
|
|||||||
if (c == '"')
|
if (c == '"')
|
||||||
c = * ++ input_line_pointer;
|
c = * ++ input_line_pointer;
|
||||||
input_line_pointer++; /* Skip null symbol terminator. */
|
input_line_pointer++; /* Skip null symbol terminator. */
|
||||||
name = xmalloc (input_line_pointer - section_name + 1);
|
name = xstrdup (section_name);
|
||||||
strcpy (name, section_name);
|
|
||||||
|
|
||||||
if (c == ',')
|
if (c == ',')
|
||||||
input_line_pointer =
|
input_line_pointer =
|
||||||
|
Reference in New Issue
Block a user