+2017-04-05 Pedro Alves <palves@redhat.com>
+
+ * main.c (captured_main_1): Use gdb::unique_xmalloc_ptr to manage
+ the memory of the temporary warning_pre_print override.
+ * utils.c (warning_pre_print): Constify.
+ * utils.h (warning_pre_print): Constify.
+
2017-04-05 Pedro Alves <palves@redhat.com>
* cli/cli-cmds.c (shell_escape): Constify 'arg' parameter.
#endif
/* Prefix warning messages with the command name. */
- warning_pre_print = xstrprintf ("%s: warning: ", gdb_program_name);
+ gdb::unique_xmalloc_ptr<char> tmp_warn_preprint
+ (xstrprintf ("%s: warning: ", gdb_program_name));
+ warning_pre_print = tmp_warn_preprint.get ();
if (! getcwd (gdb_dirbuf, sizeof (gdb_dirbuf)))
perror_warning_with_name (_("error finding working directory"));
}
/* Set off error and warning messages with a blank line. */
- xfree (warning_pre_print);
+ tmp_warn_preprint.reset ();
warning_pre_print = _("\nwarning: ");
/* Read and execute the system-wide gdbinit file, if it exists.
/* String to be printed before warning messages, if any. */
-char *warning_pre_print = "\nwarning: ";
+const char *warning_pre_print = "\nwarning: ";
int pagination_enabled = 1;
static void
/* Message to be printed before the warning message, when a warning occurs. */
-extern char *warning_pre_print;
+extern const char *warning_pre_print;
extern void error_stream (const string_file &) ATTRIBUTE_NORETURN;