diff options
author | Chris Johns <chrisj@rtems.org> | 2014-08-07 18:15:06 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2014-08-07 18:15:06 +1000 |
commit | 27d132f87f7d6f0baeb382e69c2b1e6b88a40b55 (patch) | |
tree | 8df9d28122b5aa6a791575a0737834aa8b31c4ca /rld.h | |
parent | 94a438138ff6f482eb94bb3e606707e5f977094b (diff) |
rtms-tld: Refactor the code to match a better configuration format.
Diffstat (limited to 'rld.h')
-rw-r--r-- | rld.h | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -156,11 +156,16 @@ namespace rld */ inline std::string dequote (const std::string& s) { - if ((s.front () == '"') || (s.front () == '\'')) + if (!s.empty ()) { - if (s.front () != s.back ()) - throw rld::error ("invalid quoting", "string: " + s); - return s.substr (1, s.length () - (1 + 1)); + char front = s[0]; + char back = s[s.length () - 1]; + if ((front == '"') || (front == '\'')) + { + if (front != back) + throw rld::error ("invalid quoting", "string: " + s); + return s.substr (1, s.length () - (1 + 1)); + } } return s; } |