From d5e178c1d6eb0e7c1a317b925687050aa1cb6c1b Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 13 Oct 2009 16:57:38 -0700 Subject: Consolidate print_format creation We almost had a factory in print_format::parse_print, so let's take that the rest of the way. This way we don't have so much duplication in initializing the print flags. * staptree.cxx (print_format::parse_print): Replaced with... (print_format::create): New factory to parse and create print_formats. * elaborate.cxx (add_global_var_display): Use this factory. * parse.cxx (parser::parse_symbol): Ditto. * tapset-mark.cxx (mark_var_expanding_visitor::visit_target_symbol_context): Ditto. * tapset-utrace.cxx (utrace_var_expanding_visitor::visit_target_symbol_arg): Ditto. * tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol_context): Ditto. (tracepoint_var_expanding_visitor::visit_target_symbol_context) Ditto. --- parse.cxx | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'parse.cxx') diff --git a/parse.cxx b/parse.cxx index 1496e9b8..cfefa12d 100644 --- a/parse.cxx +++ b/parse.cxx @@ -2352,8 +2352,6 @@ parser::parse_symbol () // now scrutinize this identifier for the various magic forms of identifier // (printf, @stat_op, and $var...) - bool pf_stream, pf_format, pf_delim, pf_newline, pf_char; - if (name == "@cast") { // type-punning time @@ -2410,17 +2408,8 @@ parser::parse_symbol () return sop; } - else if (print_format::parse_print(name, - pf_stream, pf_format, pf_delim, pf_newline, pf_char)) + else if (print_format *fmt = print_format::create(t)) { - print_format *fmt = new print_format; - fmt->tok = t; - fmt->print_to_stream = pf_stream; - fmt->print_with_format = pf_format; - fmt->print_with_delim = pf_delim; - fmt->print_with_newline = pf_newline; - fmt->print_char = pf_char; - expect_op("("); if ((name == "print" || name == "println" || name == "sprint" || name == "sprintln") && -- cgit