Date: Thu, 28 Jun 2018 01:45:53 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335756 - head/sbin/devd Message-ID: <201806280145.w5S1jrWE046718@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Thu Jun 28 01:45:53 2018 New Revision: 335756 URL: https://svnweb.freebsd.org/changeset/base/335756 Log: We're not, yet, at C++11 capable on all our plaforms. Use a possibly slower, but C++98 compatibe way to iterate through the string. Noticed by: g++ 4.2.1 and Mark Millard Modified: head/sbin/devd/devd.cc Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Thu Jun 28 01:32:37 2018 (r335755) +++ head/sbin/devd/devd.cc Thu Jun 28 01:45:53 2018 (r335756) @@ -640,6 +640,8 @@ string config::shell_quote(const string &s) { string buffer; + const char *cs, *ce; + char c; /* * Enclose the string in $' ' with escapes for ' and / characters making @@ -649,7 +651,10 @@ config::shell_quote(const string &s) buffer.reserve(s.length() * 3 / 2); buffer += '$'; buffer += '\''; - for (const char &c : s) { + cs = s.c_str(); + ce = cs + strlen(cs); + for (; cs < ce; cs++) { + c = *cs; if (c == '\'' || c == '\\') { buffer += '\\'; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806280145.w5S1jrWE046718>