From 278a5d3a588ed49286be8be4538cd0921b2cb181 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Mon, 6 May 2013 14:46:09 -0400 Subject: [PATCH] devd: Use simpler dst += *x instead of str.append(x, 1) Also fix typo in comment Obtained From: FreeBSD --- sbin/devd/devd.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sbin/devd/devd.cc b/sbin/devd/devd.cc index 33adf3118e..d3ac7572dd 100644 --- a/sbin/devd/devd.cc +++ b/sbin/devd/devd.cc @@ -463,7 +463,7 @@ config::expand_one(const char *&src, string &dst) src++; // $$ -> $ if (*src == '$') { - dst.append(src++, 1); + dst += *src++; return; } @@ -471,7 +471,7 @@ config::expand_one(const char *&src, string &dst) // Not sure if I want to support this or not, so for now we just pass // it through. if (*src == '(') { - dst.append("$"); + dst += '$'; count = 1; /* If the string ends before ) is matched , return. */ while (count > 0 && *src) { @@ -479,21 +479,21 @@ config::expand_one(const char *&src, string &dst) count--; else if (*src == '(') count++; - dst.append(src++, 1); + dst += *src++; } return; } - // ${^A-Za-z] -> $\1 + // $[^A-Za-z] -> $\1 if (!isalpha(*src)) { - dst.append("$"); - dst.append(src++, 1); + dst += '$'; + dst += *src++; return; } // $var -> replace with value do { - buffer.append(src++, 1); + buffer += *src++; } while (is_id_char(*src)); buffer.append("", 1); varstr = get_variable(buffer.c_str()); -- 2.41.0