summaryrefslogtreecommitdiff
path: root/cli/runtime-source.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-01-23 14:48:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-01-23 14:48:16 +0200
commit510c8ceff6e3da603b54cf9061f6efd777c66752 (patch)
tree3225ba3bda6e43cd665f0ccdff7c379914ca027c /cli/runtime-source.cxx
parent8027e319831f02538fe431b5870d90c0267b3b78 (diff)
Store option names as std::string instead of const char*
With the scanner interface we now cannot assume that the returned value will still be valid after another call to more(). This was the case when we were always scanning argv/argc but now that we have the file scanner, we have to be careful.
Diffstat (limited to 'cli/runtime-source.cxx')
-rw-r--r--cli/runtime-source.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/cli/runtime-source.cxx b/cli/runtime-source.cxx
index 7f87d1f..37dc1ac 100644
--- a/cli/runtime-source.cxx
+++ b/cli/runtime-source.cxx
@@ -474,11 +474,11 @@ generate_runtime_source (context& ctx)
<< "static void" << endl
<< "parse (X& x, " << (sp ? "bool& xs, " : "") << "scanner& s)"
<< "{"
- << "const char* o (s.next ());"
+ << "std::string o (s.next ());"
<< endl
<< "if (s.more ())"
<< "{"
- << "const char* v (s.next ());"
+ << "std::string v (s.next ());"
<< "std::istringstream is (v);"
<< "if (!(is >> x && is.eof ()))" << endl
<< "throw invalid_value (o, v);"
@@ -582,7 +582,7 @@ generate_runtime_source (context& ctx)
<< "parse (std::map<K, V>& m, " << (sp ? "bool& xs, " : "") <<
"scanner& s)"
<< "{"
- << "const char* o (s.next ());"
+ << "std::string o (s.next ());"
<< endl
<< "if (s.more ())"
<< "{"