From cd0bbe6ef9ca3d3db38a3a0f1ca993bbdc952053 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Fri, 19 Feb 2016 12:03:08 +0000 Subject: Add const to various variables in the gas sources. * symbols.c (decode_local_label_name): Make type a const char *. * listing.c (print_source): Make type of p const char *. (print_line): Make type of string const char *. (buffer_line): Return const char *. (title): Make type const char *. (subtitle): Likewise. (listing_listing): Make type of p const char *. * messages.c (as_internal_value_out_of_range): Make type of prefix const char *. * stabs.c (s_stab_generic): make type of stab_secname, stabstr_secname and string const char *. * read.c (_bfd_rel): Make type of name const char *. * app.c (out_string): Change type to const char *. (struct app_save::out_string): Likewise. --- gas/listing.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'gas/listing.c') diff --git a/gas/listing.c b/gas/listing.c index eeb349a..ee878b9 100644 --- a/gas/listing.c +++ b/gas/listing.c @@ -223,7 +223,8 @@ static file_info_type *file_info (const char *); static void new_frag (void); static void listing_page (list_info_type *); static unsigned int calc_hex (list_info_type *); -static void print_lines (list_info_type *, unsigned int, char *, unsigned int); +static void print_lines (list_info_type *, unsigned int, const char *, + unsigned int); static void list_symbol_table (void); static int debugging_pseudo (list_info_type *, const char *); static void listing_listing (char *); @@ -472,7 +473,7 @@ listing_prev_line (void) truncated to size. It appends a fake line to the end of each input file to make using the returned buffer simpler. */ -static char * +static const char * buffer_line (file_info_type *file, char *line, unsigned int size) { unsigned int count = 0; @@ -695,12 +696,11 @@ rebuffer_line (file_info_type * file, } static const char *fn; - -static unsigned int eject; /* Eject pending */ -static unsigned int page; /* Current page number */ -static char *title; /* Current title */ -static char *subtitle; /* Current subtitle */ -static unsigned int on_page; /* Number of lines printed on current page */ +static unsigned int eject; /* Eject pending. */ +static unsigned int page; /* Current page number. */ +static const char *title; /* Current title. */ +static const char *subtitle; /* Current subtitle. */ +static unsigned int on_page; /* Number of lines printed on current page. */ static void listing_page (list_info_type *list) @@ -832,7 +832,7 @@ calc_hex (list_info_type *list) static void print_lines (list_info_type *list, unsigned int lineno, - char *string, unsigned int address) + const char *string, unsigned int address) { unsigned int idx; unsigned int nchars; @@ -1095,7 +1095,7 @@ print_source (file_info_type * current_file, while (current_file->linenum < list->hll_line && !current_file->at_end) { - char *p; + const char *p; cache = cached_lines + next_free_line; cache->file = current_file; @@ -1202,7 +1202,7 @@ listing_listing (char *name ATTRIBUTE_UNUSED) list_info_type *list = head; file_info_type *current_hll_file = (file_info_type *) NULL; char *buffer; - char *p; + const char *p; int show_listing = 1; unsigned int width; -- cgit v1.1