X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Futils.c;h=0b8ec02abe6668c2ed59604335311248ea240592;hb=f65fe5704af56aca58fd5547d0841a9512e540af;hp=0c133d15614948707b4380f03bbc19ef545a326b;hpb=30baf67b6505d903bf678f9a0ba3645eb337ce49;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/utils.c b/gdb/utils.c index 0c133d1561..0b8ec02abe 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -582,9 +582,7 @@ add_internal_problem_command (struct internal_problem *problem) static std::string perror_string (const char *prefix) { - char *err; - - err = safe_strerror (errno); + const char *err = safe_strerror (errno); return std::string (prefix) + ": " + err; } @@ -630,19 +628,11 @@ perror_warning_with_name (const char *string) void print_sys_errmsg (const char *string, int errcode) { - char *err; - char *combined; - - err = safe_strerror (errcode); - combined = (char *) alloca (strlen (err) + strlen (string) + 3); - strcpy (combined, string); - strcat (combined, ": "); - strcat (combined, err); - + const char *err = safe_strerror (errcode); /* We want anything which was printed on stdout to come out first, before this message. */ gdb_flush (gdb_stdout); - fprintf_unfiltered (gdb_stderr, "%s.\n", combined); + fprintf_unfiltered (gdb_stderr, "%s: %s.\n", string, err); } /* Control C eventually causes this to be called, at a convenient time. */ @@ -3043,9 +3033,6 @@ gdb_argv::reset (const char *s) { char **argv = buildargv (s); - if (s != NULL && argv == NULL) - malloc_failure (0); - freeargv (m_argv); m_argv = argv; }