bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] debug: improve the display of symbol lists


From: Akim Demaille
Subject: [PATCH 1/2] debug: improve the display of symbol lists
Date: Mon, 11 Feb 2013 09:19:02 +0100

* src/symtab.c (symbol_print): Remove useless quotes (the symbol already
has quotes).
Prefer fputs.
* src/symlist.c (symbol_list_syms_print): Likewise.
Fix separators.
---
 src/symlist.c | 11 ++++++++---
 src/symtab.c  |  4 ++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/symlist.c b/src/symlist.c
index 72ca110..d43591a 100644
--- a/src/symlist.c
+++ b/src/symlist.c
@@ -84,12 +84,17 @@ symbol_list_type_new (uniqstr type_name, location loc)
 void
 symbol_list_syms_print (const symbol_list *l, FILE *f)
 {
+  char const *sep = "";
   for (/* Nothing. */; l && l->content.sym; l = l->next)
     {
+      fputs (sep, f);
+      fputs (l->content_type == SYMLIST_SYMBOL ? "symbol: "
+             : l->content_type == SYMLIST_TYPE ? "type: "
+             : "invalid content_type: ",
+             f);
       symbol_print (l->content.sym, f);
-      fprintf (f, l->action_props.is_value_used ? " used" : " unused");
-      if (l && l->content.sym)
-        fprintf (f, ", ");
+      fputs (l->action_props.is_value_used ? " used" : " unused", f);
+      sep = ", ";
     }
 }
 
diff --git a/src/symtab.c b/src/symtab.c
index 1768d88..b132e07 100644
--- a/src/symtab.c
+++ b/src/symtab.c
@@ -153,13 +153,13 @@ symbol_print (symbol const *s, FILE *f)
 {
   if (s)
     {
-      fprintf (f, "\"%s\"", s->tag);
+      fputs (s->tag, f);
       SYMBOL_ATTR_PRINT (type_name);
       SYMBOL_CODE_PRINT (destructor);
       SYMBOL_CODE_PRINT (printer);
     }
   else
-    fprintf (f, "<NULL>");
+    fputs ("<NULL>", f);
 }
 
 #undef SYMBOL_ATTR_PRINT
-- 
1.8.1.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]