This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] Make exception.message const
- From: Andrew Cagney <cagney at gnu dot org>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 13 Jan 2005 21:29:26 -0500
- Subject: [commit] Make exception.message const
FYI,
Tighten things up a little (also flushed out a potential double free bug
in the mi-code).
committed,
Andrew
2005-01-13 Andrew Cagney <cagney@gnu.org>
* exceptions.h (struct exception): Make message const.
* mi/mi-main.c (mi_execute_command): Pass result.message directly
to fputstr_unfiltered.
Index: exceptions.h
===================================================================
RCS file: /cvs/src/src/gdb/exceptions.h,v
retrieving revision 1.4
diff -p -u -r1.4 exceptions.h
--- exceptions.h 14 Jan 2005 01:20:36 -0000 1.4
+++ exceptions.h 14 Jan 2005 02:26:23 -0000
@@ -59,7 +59,7 @@ struct exception
{
enum return_reason reason;
enum errors error;
- char *message;
+ const char *message;
};
/* A pre-defined non-exception. */
Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.70
diff -p -u -r1.70 mi-main.c
--- mi/mi-main.c 13 Jan 2005 22:08:27 -0000 1.70
+++ mi/mi-main.c 14 Jan 2005 02:26:24 -0000
@@ -1166,13 +1166,11 @@ mi_execute_command (char *cmd, int from_
}
if (result.reason < 0)
{
- char *msg = result.message;
- struct cleanup *cleanup = make_cleanup (xfree, msg);
/* The command execution failed and error() was called
somewhere */
fputs_unfiltered (command->token, raw_stdout);
fputs_unfiltered ("^error,msg=\"", raw_stdout);
- fputstr_unfiltered (msg, '"', raw_stdout);
+ fputstr_unfiltered (result.message, '"', raw_stdout);
fputs_unfiltered ("\"\n", raw_stdout);
}
mi_parse_free (command);