common: Cleanup log & assert macro
authorTaekyun Kim <tkq.kim@samsung.com>
Thu, 13 Aug 2015 05:00:35 +0000 (14:00 +0900)
committerTaekyun Kim <tkq.kim@samsung.com>
Thu, 13 Aug 2015 05:00:35 +0000 (14:00 +0900)
Change-Id: If2dbd6ecbf1b23feffa34f0397ea5b2c962658fa

14 files changed:
src/lib/desktop-shell/desktop-shell-internal.h
src/lib/drm/drm-internal.h
src/lib/fbdev/fbdev-internal.h
src/lib/libinput/libinput-internal.h
src/lib/pepper/common.h
src/lib/pepper/pepper-utils.h
src/lib/pepper/utils-vt.c
src/lib/render/pepper-render-internal.h
src/lib/wayland/wayland-internal.h
src/lib/x11/x11-internal.h
src/samples/drm-backend.c
src/samples/fbdev-backend.c
src/samples/wayland-backend.c
src/samples/x11-backend.c

index 28dfb8b..e8b4787 100644 (file)
@@ -2,10 +2,6 @@
 #include "pepper-desktop-shell.h"
 #include <wayland-server.h>
 
-/* TODO: */
-#define PEPPER_ERROR(...)
-#define PEPPER_ASSERT(...)
-
 /* Ping timeout value in ms. */
 #define DESKTOP_SHELL_PING_TIMEOUT  200
 
index b61fd31..914499f 100644 (file)
@@ -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;
 
index 6104796..b3c6aa6 100644 (file)
@@ -10,9 +10,6 @@
 
 #include "pepper-fbdev.h"
 
-/* TODO: Error Logging. */
-#define PEPPER_ERROR(...)
-
 typedef struct fbdev_output     fbdev_output_t;
 
 struct pepper_fbdev
index dbff538..27b1ff8 100644 (file)
@@ -4,9 +4,6 @@
 #include "pepper-libinput.h"
 #include <pepper-input-backend.h>
 
-/* TODO: Error logging. */
-#define PEPPER_ERROR(...)
-
 typedef struct li_device            li_device_t;
 typedef struct li_device_property   li_device_property_t;
 
index fe6c4f9..393b0a8 100644 (file)
@@ -5,19 +5,8 @@
 #include <assert.h>
 #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);
 
index 27ea6bb..ff96fd6 100644 (file)
@@ -5,6 +5,7 @@
 #include <string.h>
 #include <stdint.h>
 #include <math.h>
+#include <assert.h>
 
 #include <pixman.h>
 
@@ -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;
index 23e3af0..24500e9 100644 (file)
@@ -10,8 +10,6 @@
 
 #include "pepper-utils.h"
 
-#define PEPPER_ERROR(...)   /* TODO */
-
 static struct _vt_data
 {
     int     tty_fd;
index f8f60ec..2427af3 100644 (file)
@@ -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. */
index 072d8d5..61f759e 100644 (file)
 #include <wayland-egl.h>
 #endif
 
-/* TODO: Error logging. */
-#define PEPPER_ERROR(...)
-#define PEPPER_ASSERT(exp)
-
 #define NUM_SHM_BUFFERS 2
 
 typedef struct wayland_output       wayland_output_t;
index 1188d01..47f48dc 100644 (file)
 
 #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;
index 5e8804f..a33cb4e 100644 (file)
@@ -9,10 +9,6 @@
 #include <pepper-drm.h>
 #include <pepper-desktop-shell.h>
 
-/* TODO: */
-#define PEPPER_ASSERT(exp)
-#define PEPPER_ERROR(...)
-
 static void
 handle_signals(int s, siginfo_t *siginfo, void *context)
 {
index a2cfc6f..3706500 100644 (file)
@@ -9,10 +9,6 @@
 #include <pepper-fbdev.h>
 #include <pepper-desktop-shell.h>
 
-/* TODO: */
-#define PEPPER_ASSERT(exp)
-#define PEPPER_ERROR(...)
-
 static void
 handle_signals(int s, siginfo_t *siginfo, void *context)
 {
index 668b68d..43e82a9 100644 (file)
@@ -1,9 +1,6 @@
 #include <pepper.h>
 #include <pepper-wayland.h>
 
-/* TODO: */
-#define PEPPER_ASSERT(exp)
-
 int
 main(int argc, char **argv)
 {
index 282ff1e..80b707f 100644 (file)
@@ -2,9 +2,6 @@
 #include <pepper-x11.h>
 #include <pepper-desktop-shell.h>
 
-/* TODO: */
-#define PEPPER_ASSERT(exp)
-
 int
 main(int argc, char **argv)
 {