]> gcc.gnu.org Git - gcc.git/commitdiff
libcc1: avoid a call to c_str
authorTom Tromey <tom@tromey.com>
Tue, 4 May 2021 21:26:58 +0000 (15:26 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 5 May 2021 06:08:52 +0000 (00:08 -0600)
This is a trivial change to libcc1 to avoid an explicit call to c_str.
Passing by const reference is slightly less wordy.

libcc1

* compiler.cc (make_regexp): Take const std::string.
(cc1_plugin::compiler_triplet_regexp::find): Update.

libcc1/compiler.cc

index fede8496862509d18e7dde36294ab54209d76a88..a12843c538ae544edeb4eff20e3efd934cc90f56 100644 (file)
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3.  If not see
 
 // Construct an appropriate regexp to match the compiler name.
 static std::string
-make_regexp (const char *triplet_regexp, const char *compiler)
+make_regexp (const std::string &triplet_regexp, const char *compiler)
 {
   std::stringstream buf;
 
@@ -71,7 +71,7 @@ char *
 cc1_plugin::compiler_triplet_regexp::find (const char *base,
                                           std::string &compiler) const
 {
-  std::string rx = make_regexp (triplet_regexp_.c_str (), base);
+  std::string rx = make_regexp (triplet_regexp_, base);
   if (verbose)
     fprintf (stderr, _("searching for compiler matching regex %s\n"),
             rx.c_str());
This page took 0.066246 seconds and 5 git commands to generate.