Use a more stream-lined version of fix_value.
Submitted by: ian@
This commit is contained in:
parent
dfe5f22fd7
commit
416823b103
@ -417,24 +417,16 @@ var_list::is_set(const string &var) const
|
||||
* converted to ". For all other characters, both \ and following
|
||||
* character. So the string 'fre\:\"' is translated to 'fred\:"'.
|
||||
*/
|
||||
const std::string &
|
||||
std::string
|
||||
var_list::fix_value(const std::string &val) const
|
||||
{
|
||||
char *tmp, *dst;
|
||||
const char *src;
|
||||
std::string *rv;
|
||||
std::string rv(val);
|
||||
std::string::size_type pos(0);
|
||||
|
||||
dst = tmp = new char[val.length()];
|
||||
src = val.c_str();
|
||||
while (*src) {
|
||||
if (*src == '\\' && src[1] == '"')
|
||||
src++;
|
||||
else
|
||||
*dst++ = *src++;
|
||||
}
|
||||
rv = new string(tmp);
|
||||
delete tmp;
|
||||
return *rv;
|
||||
while ((pos = rv.find("\\\"", pos)) != rv.npos) {
|
||||
rv.erase(pos, 1);
|
||||
}
|
||||
return (rv);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
static const std::string nothing;
|
||||
|
||||
private:
|
||||
const std::string &fix_value(const std::string &val) const;
|
||||
std::string fix_value(const std::string &val) const;
|
||||
|
||||
std::map<std::string, std::string> _vars;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user