diff options
author | Veeresh Kadasani <external.vkadasani@jp.adit-jv.com> | 2019-06-14 15:48:10 +0900 |
---|---|---|
committer | Veeresh Kadasani <external.vkadasani@jp.adit-jv.com> | 2019-06-14 15:48:10 +0900 |
commit | 46d18bf0029988033f3294242bfb5d2a3a40d322 (patch) | |
tree | e795acfdc6497c30a324184de041f3ec78c3181a | |
parent | d354891615c85e61aede39e7738714f0851bdcc1 (diff) |
waltham-receiver:define DEBUG to hide verbosity
Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
-rw-r--r-- | waltham-receiver/include/wth-receiver-comm.h | 31 | ||||
-rw-r--r-- | waltham-receiver/src/wth-receiver-comm.c | 3 | ||||
-rw-r--r-- | waltham-receiver/src/wth-receiver-gst.c | 3 | ||||
-rw-r--r-- | waltham-receiver/src/wth-receiver-main.c | 24 |
4 files changed, 36 insertions, 25 deletions
diff --git a/waltham-receiver/include/wth-receiver-comm.h b/waltham-receiver/include/wth-receiver-comm.h index 5d50996..285bacf 100644 --- a/waltham-receiver/include/wth-receiver-comm.h +++ b/waltham-receiver/include/wth-receiver-comm.h @@ -58,11 +58,14 @@ #include <waltham-server.h> #include <waltham-connection.h> +#define DEBUG 0 + struct receiver; struct client; struct window; struct pointer; struct touch; +static int verbose = 0; const struct wth_display_interface display_implementation; @@ -270,6 +273,28 @@ void waltham_touch_frame(struct window *window); */ void waltham_touch_cancel(struct window *window); +/** + * set verbosity + */ +inline void set_verbosity(int verbosity) +{ + verbose = verbosity; +} + +/** + * get verbosity + */ +inline bool get_verbosity() +{ + if (verbose == 1) + { + return true; + } + else + { + return false; + } +} /***** macros *******/ #define MAX_EPOLL_WATCHES 2 @@ -294,8 +319,14 @@ void waltham_touch_cancel(struct window *window); #define wth_error(fmt, ...) \ ({ fprintf(stderr, pr_fmt(fmt), ## __VA_ARGS__); fflush(stderr); }) + +#if DEBUG #define wth_verbose(fmt, ...) \ ({ if (get_verbosity()) { fprintf(stdout, pr_fmt(fmt), ## __VA_ARGS__); fflush(stdout); } }) +#else +#define wth_verbose(fmt, ...)\ + ({}) +#endif /****** incline functions *****/ static inline void * diff --git a/waltham-receiver/src/wth-receiver-comm.c b/waltham-receiver/src/wth-receiver-comm.c index 5939cf8..acdbef7 100644 --- a/waltham-receiver/src/wth-receiver-comm.c +++ b/waltham-receiver/src/wth-receiver-comm.c @@ -43,9 +43,6 @@ extern void wth_receiver_weston_shm_attach(struct window *, uint32_t data_sz, vo extern void wth_receiver_weston_shm_damage(struct window *); extern void wth_receiver_weston_shm_commit(struct window *); -extern bool get_verbosity(void); -extern int verbose; - /* * utility functions */ diff --git a/waltham-receiver/src/wth-receiver-gst.c b/waltham-receiver/src/wth-receiver-gst.c index 4eff69b..b151897 100644 --- a/waltham-receiver/src/wth-receiver-gst.c +++ b/waltham-receiver/src/wth-receiver-gst.c @@ -53,10 +53,7 @@ #include "ivi-application-client-protocol.h" #include "bitmap.h" #define MAX_SAMPLE 60 - static int running = 1; -extern bool get_verbosity(void); -extern int verbose; typedef struct client_sample{ GstBuffer *gstbuffer; diff --git a/waltham-receiver/src/wth-receiver-main.c b/waltham-receiver/src/wth-receiver-main.c index f246ab4..04627a8 100644 --- a/waltham-receiver/src/wth-receiver-main.c +++ b/waltham-receiver/src/wth-receiver-main.c @@ -38,26 +38,8 @@ #define MAX_EPOLL_WATCHES 2 -int verbose=0; uint16_t tcp_port; - - -/** get verbosity - */ -bool -get_verbosity() -{ - if (verbose == 1) - { - return true; - } - else - { - return false; - } -} - /** Print out the application help */ static void usage(void) @@ -104,7 +86,11 @@ static int parse_args(int argc, char *argv[]) tcp_port = atoi(optarg); break; case 'v': - verbose=1; +#if DEBUG + set_verbosity(1); +#else + printf("No verbose logs for release mode"); +#endif break; case 'h': usage(); |