[folks] tools: Avoid zero-length printf() format strings in output code paths



commit 8b786b6b6948ee70e1727060ed6d8be92365f66d
Author: Philip Withnall <withnall endlessm com>
Date:   Wed Jul 5 13:52:58 2017 +0100

    tools: Avoid zero-length printf() format strings in output code paths
    
    This triggers -Werror=format-zero-length from gcc. Add a new private
    utility function for outputting a blank line, which also makes the code
    a bit more legible.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784544

 tools/inspect/command-individuals.vala    |    2 +-
 tools/inspect/command-persona-stores.vala |    2 +-
 tools/inspect/command-personas.vala       |    2 +-
 tools/inspect/utils.vala                  |    9 +++++++--
 4 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/tools/inspect/command-individuals.vala b/tools/inspect/command-individuals.vala
index e76812b..db486e2 100644
--- a/tools/inspect/command-individuals.vala
+++ b/tools/inspect/command-individuals.vala
@@ -61,7 +61,7 @@ private class Folks.Inspect.Commands.Individuals : Folks.Inspect.Command
           foreach (var individual in this.client.aggregator.individuals.values)
             {
               Utils.print_individual (individual, false);
-              Utils.print_line ("");
+              Utils.print_blank_line ();
             }
         }
       else
diff --git a/tools/inspect/command-persona-stores.vala b/tools/inspect/command-persona-stores.vala
index c310be4..994e49b 100644
--- a/tools/inspect/command-persona-stores.vala
+++ b/tools/inspect/command-persona-stores.vala
@@ -68,7 +68,7 @@ private class Folks.Inspect.Commands.PersonaStores : Folks.Inspect.Command
               foreach (var persona_store in stores.values)
                 {
                   Utils.print_persona_store (persona_store, false);
-                  Utils.print_line ("");
+                  Utils.print_blank_line ();
                 }
             }
         }
diff --git a/tools/inspect/command-personas.vala b/tools/inspect/command-personas.vala
index 9c28582..f7f87c0 100644
--- a/tools/inspect/command-personas.vala
+++ b/tools/inspect/command-personas.vala
@@ -67,7 +67,7 @@ private class Folks.Inspect.Commands.Personas : Folks.Inspect.Command
               Utils.print_persona (persona);
 
               if (command_string == null)
-                Utils.print_line ("");
+                Utils.print_blank_line ();
               else
                 found_persona = true;
             }
diff --git a/tools/inspect/utils.vala b/tools/inspect/utils.vala
index 0b842aa..55f0bc9 100644
--- a/tools/inspect/utils.vala
+++ b/tools/inspect/utils.vala
@@ -116,6 +116,11 @@ private class Folks.Inspect.Utils
       Utils.output_filestream.puts (str);
     }
 
+  public static void print_blank_line ()
+    {
+      Utils.output_filestream.puts ("");
+    }
+
   public static void print_individual (Individual individual,
       bool show_personas)
     {
@@ -146,7 +151,7 @@ private class Folks.Inspect.Utils
 
       if (show_personas == true)
         {
-          Utils.print_line ("");
+          Utils.print_blank_line ();
           Utils.print_line ("Personas:");
 
           Utils.indent ();
@@ -221,7 +226,7 @@ private class Folks.Inspect.Utils
 
       if (show_personas == true)
         {
-          Utils.print_line ("");
+          Utils.print_blank_line ();
           Utils.print_line ("Personas:");
 
           Utils.indent ();


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