This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Make source_file_name const char *.


Hi.

I will check this patch in in a few days if there are no objections.
It just adds const to source_file_name.

[fyi, I have some other pending patches that use const char *'s for
file names that depend on this one.  This one is standalone
so I've separated it out.]

2010-04-06  Doug Evans  <dje@google.com>

	* top.c (source_file_name): Make const char *.
	* top.h (source_file_name): Update.
	* cli/cli-script.c (source_cleanup_lines_args): Make old_file
	const char *.
	(script_from_file): Change FILE arg to const char *.
	* cli/cli-script.h (script_from_file): Update.

Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.177
diff -u -p -r1.177 top.c
--- top.c	19 Jan 2010 22:23:53 -0000	1.177
+++ top.c	6 Apr 2010 19:43:40 -0000
@@ -298,7 +298,7 @@ quit_cover (void *s)
 /* NOTE 1999-04-29: This variable will be static again, once we modify
    gdb to use the event loop as the default command loop and we merge
    event-top.c into this file, top.c */
-/* static */ char *source_file_name;
+/* static */ const char *source_file_name;
 
 /* Clean up on error during a "source" command (or execution of a
    user-defined command).  */
Index: top.h
===================================================================
RCS file: /cvs/src/src/gdb/top.h,v
retrieving revision 1.21
diff -u -p -r1.21 top.h
--- top.h	6 Apr 2010 16:51:18 -0000	1.21
+++ top.h	6 Apr 2010 19:43:40 -0000
@@ -68,7 +68,7 @@ extern void gdb_init (char *);
 /* For use by event-top.c */
 /* Variables from top.c. */
 extern int source_line_number;
-extern char *source_file_name;
+extern const char *source_file_name;
 extern int history_expansion_p;
 extern int server_command;
 extern char *lim_at_start;
Index: cli/cli-script.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-script.c,v
retrieving revision 1.60
diff -u -p -r1.60 cli-script.c
--- cli/cli-script.c	28 Mar 2010 18:00:56 -0000	1.60
+++ cli/cli-script.c	6 Apr 2010 19:43:40 -0000
@@ -1557,7 +1557,7 @@ document_command (char *comname, int fro
 struct source_cleanup_lines_args
 {
   int old_line;
-  char *old_file;
+  const char *old_file;
 };
 
 static void
@@ -1584,7 +1584,7 @@ wrapped_read_command_file (struct ui_out
 /* Used to implement source_command */
 
 void
-script_from_file (FILE *stream, char *file)
+script_from_file (FILE *stream, const char *file)
 {
   struct cleanup *old_cleanups;
   struct source_cleanup_lines_args old_lines;
Index: cli/cli-script.h
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-script.h,v
retrieving revision 1.15
diff -u -p -r1.15 cli-script.h
--- cli/cli-script.h	1 Jan 2010 07:31:47 -0000	1.15
+++ cli/cli-script.h	6 Apr 2010 19:43:40 -0000
@@ -24,7 +24,7 @@ struct cmd_list_element;
 
 /* Exported to cli/cli-cmds.c */
 
-extern void script_from_file (FILE *stream, char *file);
+extern void script_from_file (FILE *stream, const char *file);
 
 extern void document_command (char *, int);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]