diff options
Diffstat (limited to 'contrib/binutils/gas/listing.c')
-rw-r--r-- | contrib/binutils/gas/listing.c | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/contrib/binutils/gas/listing.c b/contrib/binutils/gas/listing.c index c92f2db11c33..7510d8589597 100644 --- a/contrib/binutils/gas/listing.c +++ b/contrib/binutils/gas/listing.c @@ -1,6 +1,6 @@ /* listing.c - mainting assembly listings Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001 + 2001, 2002 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -92,7 +92,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA */ #include "as.h" -#include <obstack.h> +#include "obstack.h" #include "safe-ctype.h" #include "input-file.h" #include "subsegs.h" @@ -269,8 +269,7 @@ file_info (file_name) p = (file_info_type *) xmalloc (sizeof (file_info_type)); p->next = file_info_head; file_info_head = p; - p->filename = xmalloc ((unsigned long) strlen (file_name) + 1); - strcpy (p->filename, file_name); + p->filename = xstrdup (file_name); p->pos = 0; p->linenum = 0; p->at_end = 0; @@ -616,36 +615,36 @@ calc_hex (list) data_buffer_size += 2; octet_in_frag++; } - if (frag_ptr->fr_type == rs_fill) - { - unsigned int var_rep_max = octet_in_frag; - unsigned int var_rep_idx = octet_in_frag; - - /* Print as many bytes from the variable part as is sensible. */ - while (((offsetT) octet_in_frag - < (frag_ptr->fr_fix + frag_ptr->fr_var * frag_ptr->fr_offset)) - && data_buffer_size < MAX_BYTES - 3) - { - if (address == ~(unsigned int) 0) - { - address = frag_ptr->fr_address / OCTETS_PER_BYTE; - } - sprintf (data_buffer + data_buffer_size, - "%02X", - (frag_ptr->fr_literal[var_rep_idx]) & 0xff); + if (frag_ptr->fr_type == rs_fill) + { + unsigned int var_rep_max = octet_in_frag; + unsigned int var_rep_idx = octet_in_frag; + + /* Print as many bytes from the variable part as is sensible. */ + while (((offsetT) octet_in_frag + < (frag_ptr->fr_fix + frag_ptr->fr_var * frag_ptr->fr_offset)) + && data_buffer_size < MAX_BYTES - 3) + { + if (address == ~(unsigned int) 0) + { + address = frag_ptr->fr_address / OCTETS_PER_BYTE; + } + sprintf (data_buffer + data_buffer_size, + "%02X", + (frag_ptr->fr_literal[var_rep_idx]) & 0xff); #if 0 - data_buffer[data_buffer_size++] = '*'; - data_buffer[data_buffer_size++] = '*'; + data_buffer[data_buffer_size++] = '*'; + data_buffer[data_buffer_size++] = '*'; #endif - data_buffer_size += 2; + data_buffer_size += 2; - var_rep_idx++; - octet_in_frag++; + var_rep_idx++; + octet_in_frag++; - if ((offsetT) var_rep_idx >= frag_ptr->fr_fix + frag_ptr->fr_var) - var_rep_idx = var_rep_max; - } - } + if ((offsetT) var_rep_idx >= frag_ptr->fr_fix + frag_ptr->fr_var) + var_rep_idx = var_rep_max; + } + } frag_ptr = frag_ptr->fr_next; } @@ -1063,7 +1062,7 @@ listing_listing (name) if (!((listing & LISTING_NODEBUG) && debugging_pseudo (list, list->line_contents))) { - print_lines (list, + print_lines (list, list->file->linenum == 0 ? list->line : list->file->linenum, list->line_contents, calc_hex (list)); } |