X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fconfig%2Ftc-tic30.c;h=c31c7604275b81cf32c75cdb02cb811b1c095be6;hb=bd920864f3dc2cad376989a642ab774aef6b2fce;hp=71c6249422670248d9cbb582b1dfa1ea346184fb;hpb=6d4af3c269e64b0093b23bd63d302bd9f90de6a9;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/config/tc-tic30.c b/gas/config/tc-tic30.c index 71c6249422..c31c760427 100644 --- a/gas/config/tc-tic30.c +++ b/gas/config/tc-tic30.c @@ -1,5 +1,5 @@ /* tc-c30.c -- Assembly code for the Texas Instruments TMS320C30 - Copyright (C) 1998-2016 Free Software Foundation, Inc. + Copyright (C) 1998-2020 Free Software Foundation, Inc. Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) This file is part of GAS, the GNU Assembler. @@ -380,11 +380,10 @@ tic30_find_parallel_insn (char *current_line, char *next_line) } } } - parallel_insn = malloc (strlen (first_opcode) + strlen (first_operands) - + strlen (second_opcode) + strlen (second_operands) + 8); - sprintf (parallel_insn, "q_%s_%s %s | %s", - first_opcode, second_opcode, - first_operands, second_operands); + + parallel_insn = concat ("q_", first_opcode, "_", second_opcode, " ", + first_operands, " | ", second_operands, + (char *) NULL); debug ("parallel insn = %s\n", parallel_insn); return parallel_insn; } @@ -402,8 +401,7 @@ tic30_operand (char *token) operand *current_op; debug ("In tic30_operand with %s\n", token); - current_op = malloc (sizeof (* current_op)); - memset (current_op, '\0', sizeof (operand)); + current_op = XCNEW (operand); if (*token == DIRECT_REFERENCE) { @@ -464,7 +462,7 @@ tic30_operand (char *token) ind_addr_type *ind_addr_op; char * ind_buffer; - ind_buffer = xmalloc (strlen (token)); + ind_buffer = XNEWVEC (char, strlen (token)); debug ("Found indirect reference\n"); ind_buffer[0] = *token; @@ -604,9 +602,7 @@ tic30_operand (char *token) segT retval; debug ("Probably a label: %s\n", token); - current_op->immediate.label = malloc (strlen (token) + 1); - strcpy (current_op->immediate.label, token); - current_op->immediate.label[strlen (token)] = '\0'; + current_op->immediate.label = xstrdup (token); save_input_line_pointer = input_line_pointer; input_line_pointer = token; @@ -634,9 +630,7 @@ tic30_operand (char *token) for (count = 0; count < strlen (token); count++) if (*(token + count) == '.') current_op->immediate.decimal_found = 1; - current_op->immediate.label = malloc (strlen (token) + 1); - strcpy (current_op->immediate.label, token); - current_op->immediate.label[strlen (token)] = '\0'; + current_op->immediate.label = xstrdup (token); current_op->immediate.f_number = (float) atof (token); current_op->immediate.s_number = (int) atoi (token); current_op->immediate.u_number = (unsigned int) atoi (token); @@ -1395,9 +1389,9 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP) #undef MAP #undef F - rel = xmalloc (sizeof (* rel)); + rel = XNEW (arelent); gas_assert (rel != 0); - rel->sym_ptr_ptr = xmalloc (sizeof (asymbol *)); + rel->sym_ptr_ptr = XNEW (asymbol *); *rel->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy); rel->address = fixP->fx_frag->fr_address + fixP->fx_where; rel->addend = 0; @@ -2003,8 +1997,7 @@ md_assemble (char *line) for (i = 0; i < insn.operands; i++) { - if (insn.operand_type[i]->immediate.label) - free (insn.operand_type[i]->immediate.label); + free (insn.operand_type[i]->immediate.label); free (insn.operand_type[i]); } }