From: Taekyun Kim Date: Thu, 13 Aug 2015 05:00:35 +0000 (+0900) Subject: common: Cleanup log & assert macro X-Git-Tag: accepted/tizen/mobile/20151221.050925~34^2~223 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8465de300ddcdd7ae40f5492094a9e02c42ba0b9;p=platform%2Fcore%2Fuifw%2Fpepper.git common: Cleanup log & assert macro Change-Id: If2dbd6ecbf1b23feffa34f0397ea5b2c962658fa --- diff --git a/src/lib/desktop-shell/desktop-shell-internal.h b/src/lib/desktop-shell/desktop-shell-internal.h index 28dfb8b..e8b4787 100644 --- a/src/lib/desktop-shell/desktop-shell-internal.h +++ b/src/lib/desktop-shell/desktop-shell-internal.h @@ -2,10 +2,6 @@ #include "pepper-desktop-shell.h" #include -/* TODO: */ -#define PEPPER_ERROR(...) -#define PEPPER_ASSERT(...) - /* Ping timeout value in ms. */ #define DESKTOP_SHELL_PING_TIMEOUT 200 diff --git a/src/lib/drm/drm-internal.h b/src/lib/drm/drm-internal.h index b61fd31..914499f 100644 --- a/src/lib/drm/drm-internal.h +++ b/src/lib/drm/drm-internal.h @@ -13,9 +13,6 @@ #define DUMB_FB_COUNT 2 -/* TODO: Error Logging. */ -#define PEPPER_ERROR(...) - typedef struct drm_output drm_output_t; typedef struct drm_fb drm_fb_t; diff --git a/src/lib/fbdev/fbdev-internal.h b/src/lib/fbdev/fbdev-internal.h index 6104796..b3c6aa6 100644 --- a/src/lib/fbdev/fbdev-internal.h +++ b/src/lib/fbdev/fbdev-internal.h @@ -10,9 +10,6 @@ #include "pepper-fbdev.h" -/* TODO: Error Logging. */ -#define PEPPER_ERROR(...) - typedef struct fbdev_output fbdev_output_t; struct pepper_fbdev diff --git a/src/lib/libinput/libinput-internal.h b/src/lib/libinput/libinput-internal.h index dbff538..27b1ff8 100644 --- a/src/lib/libinput/libinput-internal.h +++ b/src/lib/libinput/libinput-internal.h @@ -4,9 +4,6 @@ #include "pepper-libinput.h" #include -/* TODO: Error logging. */ -#define PEPPER_ERROR(...) - typedef struct li_device li_device_t; typedef struct li_device_property li_device_property_t; diff --git a/src/lib/pepper/common.h b/src/lib/pepper/common.h index fe6c4f9..393b0a8 100644 --- a/src/lib/pepper/common.h +++ b/src/lib/pepper/common.h @@ -5,19 +5,8 @@ #include #include "pepper.h" -#define PEPPER_ASSERT(expr) assert(expr) -#define PEPPER_INLINE __inline__ #define PEPPER_IGNORE(x) (void)x -/* TODO: Change logging destination. */ - -#define PEPPER_ERROR(fmt, ...) \ - do { \ - printf("%s:%s: "fmt, __FILE__, __FUNCTION__, ##__VA_ARGS__); \ - } while (0) - -#define PEPPER_TRACE PEPPER_ERROR - char * pepper_string_alloc(int len); diff --git a/src/lib/pepper/pepper-utils.h b/src/lib/pepper/pepper-utils.h index 27ea6bb..ff96fd6 100644 --- a/src/lib/pepper/pepper-utils.h +++ b/src/lib/pepper/pepper-utils.h @@ -5,6 +5,7 @@ #include #include #include +#include #include @@ -299,6 +300,16 @@ pepper_create_anonymous_file(off_t size); PEPPER_API int pepper_log(const char* domain, int level, const char *format, ...); +#define PEPPER_ERROR(fmt, ...) \ + do { \ + pepper_log("ERROR", 0, "%s:%s: "fmt, __FILE__, __FUNCTION__, ##__VA_ARGS__); \ + } while (0) + +PEPPER_API void +pepper_assert(pepper_bool_t exp); + +#define PEPPER_ASSERT(exp) assert(exp) + typedef struct pepper_mat4 pepper_mat4_t; typedef struct pepper_vec4 pepper_vec4_t; typedef struct pepper_vec3 pepper_vec3_t; diff --git a/src/lib/pepper/utils-vt.c b/src/lib/pepper/utils-vt.c index 23e3af0..24500e9 100644 --- a/src/lib/pepper/utils-vt.c +++ b/src/lib/pepper/utils-vt.c @@ -10,8 +10,6 @@ #include "pepper-utils.h" -#define PEPPER_ERROR(...) /* TODO */ - static struct _vt_data { int tty_fd; diff --git a/src/lib/render/pepper-render-internal.h b/src/lib/render/pepper-render-internal.h index f8f60ec..2427af3 100644 --- a/src/lib/render/pepper-render-internal.h +++ b/src/lib/render/pepper-render-internal.h @@ -3,10 +3,6 @@ #include "pepper-render.h" -/* TODO: Error logging. */ -#define PEPPER_ASSERT(exp) -#define PEPPER_ERROR(...) - struct pepper_render_target { /* Renderer from where this target is created. */ diff --git a/src/lib/wayland/wayland-internal.h b/src/lib/wayland/wayland-internal.h index 072d8d5..61f759e 100644 --- a/src/lib/wayland/wayland-internal.h +++ b/src/lib/wayland/wayland-internal.h @@ -12,10 +12,6 @@ #include #endif -/* TODO: Error logging. */ -#define PEPPER_ERROR(...) -#define PEPPER_ASSERT(exp) - #define NUM_SHM_BUFFERS 2 typedef struct wayland_output wayland_output_t; diff --git a/src/lib/x11/x11-internal.h b/src/lib/x11/x11-internal.h index 1188d01..47f48dc 100644 --- a/src/lib/x11/x11-internal.h +++ b/src/lib/x11/x11-internal.h @@ -16,16 +16,8 @@ #define X11_BACKEND_INPUT_ID 0x12345678 -/* TODO: Error logging. */ -#define PEPPER_ERROR(fmt, ...) \ - do { \ - printf("%s:%s: "fmt, __FILE__, __FUNCTION__, ##__VA_ARGS__); \ - } while (0) - #define PEPPER_TRACE(x) -#define PEPPER_ASSERT(exp) - typedef struct x11_output x11_output_t; typedef struct x11_cursor x11_cursor_t; typedef struct x11_seat x11_seat_t; diff --git a/src/samples/drm-backend.c b/src/samples/drm-backend.c index 5e8804f..a33cb4e 100644 --- a/src/samples/drm-backend.c +++ b/src/samples/drm-backend.c @@ -9,10 +9,6 @@ #include #include -/* TODO: */ -#define PEPPER_ASSERT(exp) -#define PEPPER_ERROR(...) - static void handle_signals(int s, siginfo_t *siginfo, void *context) { diff --git a/src/samples/fbdev-backend.c b/src/samples/fbdev-backend.c index a2cfc6f..3706500 100644 --- a/src/samples/fbdev-backend.c +++ b/src/samples/fbdev-backend.c @@ -9,10 +9,6 @@ #include #include -/* TODO: */ -#define PEPPER_ASSERT(exp) -#define PEPPER_ERROR(...) - static void handle_signals(int s, siginfo_t *siginfo, void *context) { diff --git a/src/samples/wayland-backend.c b/src/samples/wayland-backend.c index 668b68d..43e82a9 100644 --- a/src/samples/wayland-backend.c +++ b/src/samples/wayland-backend.c @@ -1,9 +1,6 @@ #include #include -/* TODO: */ -#define PEPPER_ASSERT(exp) - int main(int argc, char **argv) { diff --git a/src/samples/x11-backend.c b/src/samples/x11-backend.c index 282ff1e..80b707f 100644 --- a/src/samples/x11-backend.c +++ b/src/samples/x11-backend.c @@ -2,9 +2,6 @@ #include #include -/* TODO: */ -#define PEPPER_ASSERT(exp) - int main(int argc, char **argv) {