devd: Use simpler dst += *x instead of str.append(x, 1).

Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Approved by:	cperciva (mentor)
This commit is contained in:
eadler 2013-03-04 02:21:29 +00:00
parent d359c8655e
commit a3065a2b58

View File

@ -585,7 +585,7 @@ config::expand_one(const char *&src, string &dst)
src++;
// $$ -> $
if (*src == '$') {
dst.append(src++, 1);
dst += *src++;
return;
}
@ -593,7 +593,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) {
@ -601,21 +601,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
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));
dst.append(get_variable(buffer));
}