public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: clean up some inefficient std::string usage
@ 2022-12-16 13:30 Andrew Burgess
  0 siblings, 0 replies; only message in thread
From: Andrew Burgess @ 2022-12-16 13:30 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=38c0c0cac9f4b0298312ca6791db155dfaaf8442

commit 38c0c0cac9f4b0298312ca6791db155dfaaf8442
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Thu Dec 15 16:50:57 2022 +0000

    gdb: clean up some inefficient std::string usage
    
    This commit:
    
      commit 53cf95c3389a3ecd97276d322e4a60fe3396a201
      Date:   Wed Dec 14 14:17:44 2022 +0000
    
          gdb: make more use of make_target_connection_string
    
    Introduced a couple of inefficient uses of std::string, both of which
    are fixed in this commit.
    
    There should be no user visible changes after this commit.
    
    Approved-By: Simon Marchi <simon.marchi@efficios.com>

Diff:
---
 gdb/inferior.c          | 3 +--
 gdb/target-connection.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/gdb/inferior.c b/gdb/inferior.c
index 3d2bce9df7b..928305fc79d 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -486,8 +486,7 @@ uiout_field_connection (process_stratum_target *proc_target)
     return {};
   else
     {
-      std::string conn_str
-	= make_target_connection_string (proc_target).c_str ();
+      std::string conn_str = make_target_connection_string (proc_target);
       return string_printf ("%d (%s)", proc_target->connection_number,
 			    conn_str.c_str ());
     }
diff --git a/gdb/target-connection.c b/gdb/target-connection.c
index d88b9c8f563..55818cf28dc 100644
--- a/gdb/target-connection.c
+++ b/gdb/target-connection.c
@@ -91,7 +91,7 @@ print_connection (struct ui_out *uiout, const char *requested_connections)
 
       process_stratum_target *t = it.second;
 
-      size_t l = strlen (make_target_connection_string (t).c_str ());
+      size_t l = make_target_connection_string (t).length ();
       if (l > what_len)
 	what_len = l;
     }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-16 13:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-16 13:30 [binutils-gdb] gdb: clean up some inefficient std::string usage Andrew Burgess

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).