diff options
author | fche <fche> | 2006-11-08 18:31:01 +0000 |
---|---|---|
committer | fche <fche> | 2006-11-08 18:31:01 +0000 |
commit | c4bb5be2defde1d2f99ede96b6de48684f8934e6 (patch) | |
tree | cc158a39bb21309202f9f71be5c35c9b0cd68253 | |
parent | 72dbc9153036800cefdb5f2970666acc82cdb732 (diff) | |
download | systemtap-steved-c4bb5be2defde1d2f99ede96b6de48684f8934e6.tar.gz systemtap-steved-c4bb5be2defde1d2f99ede96b6de48684f8934e6.tar.xz systemtap-steved-c4bb5be2defde1d2f99ede96b6de48684f8934e6.zip |
2006-11-08 Frank Ch. Eigler <fche@elastic.org>
* staptree.cxx (print_format::components_to_string): Quote ".
(c_unparser::visit_print_format): Don't use lex_cast_qstring
as it overdoes \ quoting. Resemble ::visit_literal_string
instead.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | staptree.cxx | 3 | ||||
-rw-r--r-- | translate.cxx | 3 |
3 files changed, 12 insertions, 1 deletions
@@ -1,5 +1,12 @@ 2006-11-08 Frank Ch. Eigler <fche@elastic.org> + * staptree.cxx (print_format::components_to_string): Quote ". + (c_unparser::visit_print_format): Don't use lex_cast_qstring + as it overdoes \ quoting. Resemble ::visit_literal_string + instead. + +2006-11-08 Frank Ch. Eigler <fche@elastic.org> + * util.h (lex_cast_qstring): Move def'n here. Also quote \. (stringify, lex_cast, lex_cast_hex): Move defn here. * buildrun.cxx, elaborate.cxx, main.cxx, staptree.cxx: Adapt. diff --git a/staptree.cxx b/staptree.cxx index 1656f64a..f3352f24 100644 --- a/staptree.cxx +++ b/staptree.cxx @@ -341,8 +341,11 @@ print_format::components_to_string(vector<format_component> const & components) for (string::const_iterator j = i->literal_string.begin(); j != i->literal_string.end(); ++j) { + // See also: c_unparser::visit_literal_string and lex_cast_qstring if (*j == '%') oss << '%'; + else if(*j == '"') + oss << '\\'; oss << *j; } } diff --git a/translate.cxx b/translate.cxx index bed83ed6..1a1ae09e 100644 --- a/translate.cxx +++ b/translate.cxx @@ -2564,6 +2564,7 @@ c_unparser::visit_literal_string (literal_string* e) // an escape sequence, leaving it to the C compiler (and this function) // to treat it as such. If we were to escape it, there would be no way // of generating C-level escapes from script code. + // See also print_format::components_to_string and lex_cast_qstring if (v[i] == '"') // or other escapeworthy characters? o->line() << '\\' << '"'; else @@ -3690,7 +3691,7 @@ c_unparser::visit_print_format (print_format* e) else o->newline() << "_stp_snprintf (" << res.qname() << ", MAXSTRINGLEN, "; - o->line() << lex_cast_qstring(print_format::components_to_string(components)); + o->line() << '"' << print_format::components_to_string(components) << '"'; for (unsigned i = 0; i < tmp.size(); ++i) o->line() << ", " << tmp[i].qname(); |