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 28dfb8b4774cc1f305abb8b131651ba5e7050039..e8b4787453fcdc4091cfc3e1cc034095ff91faeb 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 b61fd3102ad3ddbcc3e6b1980d66977bb4c81ae9..914499fde7a76252e39def89f817fc0065b77e4e 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 6104796f79e2c51a8914ab23503773254b1466c4..b3c6aa6b11159a5125a1e356a3a464ed4e3c3911 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 dbff538bf1ae34d3185805deed14d250637c40b4..27b1ff85fb7323d7be0b51bba426c5fb86db1f54 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 fe6c4f9c412de8175de938c34ae1ac38db7d1fa0..393b0a84f2ac71a67b7343be38cb6029512beeb5 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 27ea6bb5525a399d5eea01f0b010e0b0d6b38ef4..ff96fd6a07f5c32cbeed60df3e4d3dbfd377f13d 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 23e3af0e5d697d394b226f635760b25adba57de0..24500e9b8693e3f39674684b5369be51becf2e7b 100644 (file)
@@ -10,8 +10,6 @@
 
 #include "pepper-utils.h"
 
-#define PEPPER_ERROR(...)   /* TODO */
-
 static struct _vt_data
 {
     int     tty_fd;
index f8f60eca8c2280420f34eb42399c7ff47a523b43..2427af3bb8de206df97e37d526aa0a6f7dfbd50c 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 072d8d548d252eb7f3d3091109ce88400741c2ba..61f759edcccfdcd4a74b8a8be360630e29d58603 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 1188d010ae59689262ddb0dded70c1b1778e84ce..47f48dca162f41d547d1b42b4780418ccbdb4b2d 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 5e8804f32484eb327c30bca16834a54b82688713..a33cb4e00d32329ade896f146b81a1ae8cb89bbb 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 a2cfc6f738aa30cc4b4cb9cf82736d76b46e4627..37065009d7e7696894b6f7c74f9c8fc5868e6c03 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 668b68d26c8231e2a6bde3284eb7f5a14077e8de..43e82a929f5e375a9a1d1a8ecc053ece08755b04 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 282ff1e19536f1544fdb413bb899f2fcd2e99019..80b707fa319dba8c2efc61319be6cec6608bc3c5 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)
 {