gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] 02/30: gnunet-qr: Simplify verbose messaging.


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 02/30: gnunet-qr: Simplify verbose messaging.
Date: Wed, 03 Apr 2019 13:53:43 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

commit eaf7440ec8e19df09b0ae632c4b200a0511069aa
Author: Hartmut Goebel <address@hidden>
AuthorDate: Sat Mar 2 12:37:46 2019 +0100

    gnunet-qr: Simplify verbose messaging.
---
 src/util/gnunet-qr.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/util/gnunet-qr.c b/src/util/gnunet-qr.c
index c02212a51..b375d20a7 100644
--- a/src/util/gnunet-qr.c
+++ b/src/util/gnunet-qr.c
@@ -38,6 +38,8 @@ static const char *usage_note =
   "GNUnet home page: https://gnunet.org/\n";
   "General help using GNU software: https://www.gnu.org/gethelp/\n";;
 
+#define LOG(fmt, ...) if (verbose == true) printf(fmt, ## __VA_ARGS__)
+
 int main (int argc, char **argv)
 {
   const char* configuration = NULL;
@@ -83,9 +85,7 @@ int main (int argc, char **argv)
   }
 
   /* create a Processor */
-  if (verbose == true) {
-    printf("Initializing\n");
-  };
+  LOG("Initializing\n");
   zbar_processor_t *proc = zbar_processor_create(1);
 
   // FIXME: Wrap all this into a function which returns an error on
@@ -95,9 +95,7 @@ int main (int argc, char **argv)
   zbar_processor_parse_config(proc, "enable");
 
   /* initialize the Processor */
-  if (verbose == true) {
-    printf("Opening video device %s\n", device);
-  };
+  LOG("Opening video device %s\n", device);
   // FIXME: error handling
   zbar_processor_init(proc, device, 1);
 
@@ -109,14 +107,10 @@ int main (int argc, char **argv)
   //zbar_processor_user_wait(proc, -1);
 
   // read at least one barcode (or until window closed)
-  if (verbose == true) {
-    printf("Capturing\n");
-  }
+  LOG("Capturing\n");
   int n;
   n = zbar_process_one(proc, -1);
-  if (verbose == true) {
-    printf("Got %i images\n", n);
-  };
+  LOG("Got %i images\n", n);
   // FIXME: Error handling (n = -1)
 
   // hide the preview window
@@ -131,11 +125,9 @@ int main (int argc, char **argv)
 
   if (symbol != NULL) {
     const char* data = zbar_symbol_get_data(symbol);
-    if (verbose = true) {
-      zbar_symbol_type_t type =
-      printf("Found %s \"%s\"\n",
-            zbar_get_symbol_name(zbar_symbol_get_type(symbol)), data);
-    }
+    LOG("Found %s \"%s\"\n",
+       zbar_get_symbol_name(zbar_symbol_get_type(symbol)), data);
+
     /* TODO
     args = ["gnunet-uri",
            // FIXME: "-c", configuration,

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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