public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Simplify print_sys_errmsg
Date: Fri, 01 Nov 2019 17:42:00 -0000	[thread overview]
Message-ID: <5df96a4e6e8f1521274acb5beb54063c35aeec6e@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 5df96a4e6e8f1521274acb5beb54063c35aeec6e ***

commit 5df96a4e6e8f1521274acb5beb54063c35aeec6e
Author:     Tom Tromey <tromey@adacore.com>
AuthorDate: Thu Oct 31 16:46:16 2019 -0600
Commit:     Tom Tromey <tromey@adacore.com>
CommitDate: Fri Nov 1 10:34:21 2019 -0600

    Simplify print_sys_errmsg
    
    On irc, Christian pointed out that print_sys_errmsg could be
    simplified by avoiding alloca entirely.  This patch implements this.
    
    gdb/ChangeLog
    2019-11-01  Tom Tromey  <tromey@adacore.com>
    
            * utils.c (print_sys_errmsg): Simplify.
    
    Change-Id: Ic399dade274ea61b63ef0540b3a3be2f0f80160a

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 500c4868c8..34e332b033 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2019-11-01  Tom Tromey  <tromey@adacore.com>
+
+	* utils.c (print_sys_errmsg): Simplify.
+
 2019-11-01  Tom Tromey  <tromey@adacore.com>
 
 	* gdbsupport/mingw-strerror.c (safe_strerror): Constify result.
diff --git a/gdb/utils.c b/gdb/utils.c
index e06eeddeef..f7fae35729 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -629,15 +629,10 @@ void
 print_sys_errmsg (const char *string, int errcode)
 {
   const char *err = safe_strerror (errcode);
-  char *combined = (char *) alloca (strlen (err) + strlen (string) + 3);
-  strcpy (combined, string);
-  strcat (combined, ": ");
-  strcat (combined, err);
-
   /* 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.  */


             reply	other threads:[~2019-11-01 17:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01 17:42 gdb-buildbot [this message]
2019-11-01 17:42 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot
2019-11-01 18:28 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2019-11-20  3:46 ` Failures on Fedora-i686, " gdb-buildbot
2019-11-20  4:39 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-11-20  6:14 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5df96a4e6e8f1521274acb5beb54063c35aeec6e@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).