summaryrefslogtreecommitdiff
path: root/rld.h
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2014-08-07 18:15:06 +1000
committerChris Johns <chrisj@rtems.org>2014-08-07 18:15:06 +1000
commit27d132f87f7d6f0baeb382e69c2b1e6b88a40b55 (patch)
tree8df9d28122b5aa6a791575a0737834aa8b31c4ca /rld.h
parent94a438138ff6f482eb94bb3e606707e5f977094b (diff)
rtms-tld: Refactor the code to match a better configuration format.
Diffstat (limited to 'rld.h')
-rw-r--r--rld.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/rld.h b/rld.h
index 36ab013..1f5e60b 100644
--- a/rld.h
+++ b/rld.h
@@ -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;
}