This is the mail archive of the gdb-patches@sources.redhat.com 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] ``const char *'' query, et.al.


Hello,

The attached tightens up a few more string functions so that they accept 
constant strings.

Andrew
2002-02-25  Andrew Cagney  <ac131313@redhat.com>

	* utils.c (perror_with_name): Make string parameter constant.
	(print_sys_errmsg): Ditto.
	(query): Ditto.
	* defs.h (perror_with_name): Update.
	(print_sys_errmsg): Update.
	(query): Update.

Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.80
diff -u -r1.80 defs.h
--- defs.h	2002/02/24 21:53:01	1.80
+++ defs.h	2002/02/26 03:24:32
@@ -568,7 +568,7 @@
 
 extern int myread (int, char *, int);
 
-extern int query (char *, ...) ATTR_FORMAT (printf, 1, 2);
+extern int query (const char *, ...) ATTR_FORMAT (printf, 1, 2);
 
 extern void init_page_info (void);
 
@@ -698,9 +698,9 @@
 extern void fprintf_symbol_filtered (struct ui_file *, char *,
 				     enum language, int);
 
-extern NORETURN void perror_with_name (char *) ATTR_NORETURN;
+extern NORETURN void perror_with_name (const char *) ATTR_NORETURN;
 
-extern void print_sys_errmsg (char *, int);
+extern void print_sys_errmsg (const char *, int);
 
 /* From regex.c or libc.  BSD 4.4 declares this with the argument type as
    "const char *" in unistd.h, so we can't declare the argument
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.65
diff -u -r1.65 utils.c
--- utils.c	2002/02/23 21:54:25	1.65
+++ utils.c	2002/02/26 03:24:42
@@ -764,7 +764,7 @@
    Then return to command level.  */
 
 NORETURN void
-perror_with_name (char *string)
+perror_with_name (const char *string)
 {
   char *err;
   char *combined;
@@ -788,7 +788,7 @@
    as the file name for which the error was encountered.  */
 
 void
-print_sys_errmsg (char *string, int errcode)
+print_sys_errmsg (const char *string, int errcode)
 {
   char *err;
   char *combined;
@@ -1201,7 +1201,7 @@
 
 /* VARARGS */
 int
-query (char *ctlstr,...)
+query (const char *ctlstr,...)
 {
   va_list args;
   register int answer;

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