From aca66a36681ac7cbf7fcc2eac4dafc83d6559ef9 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 2 Sep 2009 16:14:08 -0700 Subject: Unify lex_cast* and avoid string copies We always use lex_cast either to string or from string, so I made that explicit, and got rid of some string copies in the process. There was also stringify(), which was redundant to lex_cast. We also always used lex_cast_hex to string, so that's now hard-coded and again eliminated a string copy. For lex_cast_qstring, there's no need to write the streamify the input, so a specialization now operates directly on the input. Hopefully this is a bit cleaner, and I do measure it to be a little faster on scripts with many probes. --- parse.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'parse.cxx') diff --git a/parse.cxx b/parse.cxx index a2e2b656..bfd7600f 100644 --- a/parse.cxx +++ b/parse.cxx @@ -754,9 +754,8 @@ lexer::scan (bool wildcard) idx <= session.args.size()); // prevent overflow if (idx == 0 || idx-1 >= session.args.size()) - throw parse_error ("command line argument index " + lex_cast(idx) - + " out of range [1-" + lex_cast(session.args.size()) + "]", n); - + throw parse_error ("command line argument index " + lex_cast(idx) + + " out of range [1-" + lex_cast(session.args.size()) + "]", n); string arg = session.args[idx-1]; if (c == '$') input_put (arg); else input_put (lex_cast_qstring (arg)); -- cgit