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



commit f53094b6d48a5eb9b9ad99c10f28e5ed512c130b
Author: Philip Withnall <withnall endlessm com>
Date:   Wed Jul 5 13:50:25 2017 +0100

    core: Avoid zero-length printf() format strings in debug code paths
    
    This triggers -Werror=format-zero-length from gcc. Rather than introduce
    new public API on the Debug class for this purpose, just work around it
    by %s formatting an empty string.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784544

 backends/telepathy/lib/tpf-persona-store.vala |    3 ++-
 folks/backend-store.vala                      |    3 ++-
 folks/individual-aggregator.vala              |    3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index 35fe7f1..ef2e9ca 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -386,7 +386,8 @@ public class Tpf.PersonaStore : Folks.PersonaStore
 
       debug.unindent ();
 
-      debug.print_line (domain, level, "");
+      /* Finish with a blank line. The format string must be non-empty. */
+      debug.print_line (domain, level, "%s", "");
     }
 
   private void _reset ()
diff --git a/folks/backend-store.vala b/folks/backend-store.vala
index f9be840..4d2b3f5 100644
--- a/folks/backend-store.vala
+++ b/folks/backend-store.vala
@@ -257,7 +257,8 @@ public class Folks.BackendStore : Object {
 
       debug.unindent ();
 
-      debug.print_line (domain, level, "");
+      /* Finish with a blank line. The format string must be non-empty. */
+      debug.print_line (domain, level, "%s", "");
     }
 
   /**
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index d3af181..2d8e92f 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -666,7 +666,8 @@ public class Folks.IndividualAggregator : Object
 
       debug.unindent ();
 
-      debug.print_line (domain, level, "");
+      /* Finish with a blank line. The format string must be non-empty. */
+      debug.print_line (domain, level, "%s", "");
     }
 
   /**


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