Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Mar 2013 02:21:20 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r247758 - head/sbin/devd
Message-ID:  <201303040221.r242LKGY084987@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Mon Mar  4 02:21:19 2013
New Revision: 247758
URL: http://svnweb.freebsd.org/changeset/base/247758

Log:
  devd: Avoid unnecessary temporary objects (and simplify the code) when handling std::string.
  
  Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
  Approved by:	cperciva (mentor)

Modified:
  head/sbin/devd/devd.cc

Modified: head/sbin/devd/devd.cc
==============================================================================
--- head/sbin/devd/devd.cc	Mon Mar  4 02:21:17 2013	(r247757)
+++ head/sbin/devd/devd.cc	Mon Mar  4 02:21:19 2013	(r247758)
@@ -460,7 +460,7 @@ config::open_pidfile()
 {
 	pid_t otherpid;
 	
-	if (_pidfile == "")
+	if (_pidfile.empty())
 		return;
 	pfh = pidfile_open(_pidfile.c_str(), 0600, &otherpid);
 	if (pfh == NULL) {
@@ -528,7 +528,7 @@ config::add_notify(int prio, event_proc 
 void
 config::set_pidfile(const char *fn)
 {
-	_pidfile = string(fn);
+	_pidfile = fn;
 }
 
 void
@@ -617,7 +617,7 @@ config::expand_one(const char *&src, str
 	do {
 		buffer.append(src++, 1);
 	} while (is_id_char(*src));
-	dst.append(get_variable(buffer.c_str()));
+	dst.append(get_variable(buffer));
 }
 
 const string



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303040221.r242LKGY084987>