[PATCH 07/13] input-file: make some file name variables const
tbsaunde+binutils@tbsaunde.org
tbsaunde+binutils@tbsaunde.org
Mon Feb 22 12:34:00 GMT 2016
From: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
gas/ChangeLog:
2016-02-21 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* input-file.c (file_name): Change type to const char *.
(saved_file::file_name): Likewise.
(input_file_open): Change type of argument to const char *.
* input-file.h (input_file_open): Adjust.
---
gas/input-file.c | 8 +++++---
gas/input-file.h | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/gas/input-file.c b/gas/input-file.c
index 08ffa46..a3dcd9d 100644
--- a/gas/input-file.c
+++ b/gas/input-file.c
@@ -42,13 +42,13 @@ int preprocess = 0;
/* We use static data: the data area is not sharable. */
static FILE *f_in;
-static char *file_name;
+static const char *file_name;
/* Struct for saving the state of this module for file includes. */
struct saved_file
{
FILE * f_in;
- char * file_name;
+ const char * file_name;
int preprocess;
char * app_save;
};
@@ -111,8 +111,10 @@ input_file_pop (char *arg)
free (arg);
}
+/* Open the specified file, "" means stdin. Filename must not be null. */
+
void
-input_file_open (char *filename, /* "" means use stdin. Must not be 0. */
+input_file_open (const char *filename,
int pre)
{
int c;
diff --git a/gas/input-file.h b/gas/input-file.h
index cedaa9b..3581046 100644
--- a/gas/input-file.h
+++ b/gas/input-file.h
@@ -61,5 +61,5 @@ size_t input_file_buffer_size (void);
void input_file_begin (void);
void input_file_close (void);
void input_file_end (void);
-void input_file_open (char *filename, int pre);
+void input_file_open (const char *filename, int pre);
void input_file_pop (char *arg);
--
2.7.0
More information about the Binutils
mailing list