Commit da3ebf2d by Tom de Vries Committed by Tom de Vries

Simplify loop in pp_write_text_as_dot_label_to_stream

2016-04-17  Tom de Vries  <tom@codesourcery.com>

	* pretty-print.c (pp_write_text_as_dot_label_to_stream): Simplify loop
	structure.

From-SVN: r235075
parent 182c7868
2016-04-17 Tom de Vries <tom@codesourcery.com> 2016-04-17 Tom de Vries <tom@codesourcery.com>
* pretty-print.c (pp_write_text_as_dot_label_to_stream): Simplify loop
structure.
2016-04-17 Tom de Vries <tom@codesourcery.com>
PR other/70185 PR other/70185
* tree-pass.h (class opt_pass): Remove graph_dump_initialized member. * tree-pass.h (class opt_pass): Remove graph_dump_initialized member.
* dumpfile.h (struct dump_file_info): Add graph_dump_initialized field. * dumpfile.h (struct dump_file_info): Add graph_dump_initialized field.
......
...@@ -159,20 +159,20 @@ pp_write_text_as_dot_label_to_stream (pretty_printer *pp, bool for_record) ...@@ -159,20 +159,20 @@ pp_write_text_as_dot_label_to_stream (pretty_printer *pp, bool for_record)
const char *p = text; const char *p = text;
FILE *fp = pp_buffer (pp)->stream; FILE *fp = pp_buffer (pp)->stream;
while (*p) for (;*p; p++)
{ {
bool escape_char;
switch (*p) switch (*p)
{ {
/* Print newlines as a left-aligned newline. */ /* Print newlines as a left-aligned newline. */
case '\n': case '\n':
fputs ("\\l\\\n", fp); fputs ("\\l", fp);
escape_char = true;
break; break;
/* A pipe is only special for record-shape nodes. */ /* A pipe is only special for record-shape nodes. */
case '|': case '|':
if (for_record) escape_char = for_record;
fputc ('\\', fp);
fputc (*p, fp);
break; break;
/* The following characters always have to be escaped /* The following characters always have to be escaped
...@@ -183,13 +183,18 @@ pp_write_text_as_dot_label_to_stream (pretty_printer *pp, bool for_record) ...@@ -183,13 +183,18 @@ pp_write_text_as_dot_label_to_stream (pretty_printer *pp, bool for_record)
case '>': case '>':
case '"': case '"':
case ' ': case ' ':
fputc ('\\', fp); escape_char = true;
/* fall through */ break;
default: default:
fputc (*p, fp); escape_char = false;
break; break;
} }
p++;
if (escape_char)
fputc ('\\', fp);
fputc (*p, fp);
} }
pp_clear_output_area (pp); pp_clear_output_area (pp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment