summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-22 15:50:27 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-22 15:50:27 +0200
commitea9457699ba1eb2b01521bd2aecb15fa3488a633 (patch)
treea5631b9eef3d6b4e3bf9c01f5da819ff91424ca3
parente2e13629a7285fcaa84c52971315e6564dc19ef8 (diff)
downloadedoors-ea9457699ba1eb2b01521bd2aecb15fa3488a633.zip
edoors-ea9457699ba1eb2b01521bd2aecb15fa3488a633.tar.gz
PRINTPTR macro replace pointer cast to unsigned int
-rw-r--r--src/lib/eiotas_board.c2
-rw-r--r--src/lib/eiotas_door.c2
-rw-r--r--src/lib/eiotas_iota.c6
-rw-r--r--src/lib/eiotas_link.c2
-rw-r--r--src/lib/eiotas_particle.c2
-rw-r--r--src/lib/eiotas_private.h7
-rw-r--r--src/lib/eiotas_room.c2
-rw-r--r--src/lib/eiotas_spin.c2
-rw-r--r--tests/main.c9
9 files changed, 24 insertions, 10 deletions
diff --git a/src/lib/eiotas_board.c b/src/lib/eiotas_board.c
index 73d60c2..86572fd 100644
--- a/src/lib/eiotas_board.c
+++ b/src/lib/eiotas_board.c
@@ -27,7 +27,7 @@ EAPI Eiotas_Board* eiotas_board_add(const char* name, Eiotas_Room *parent, Eiota
void eiotas_board_free(Eiotas_Board *board)
{
- DBG("Door free 0x%X",(unsigned int)board);
+ DBG("Door free 0x%X",PRINTPTR(board));
// TODO
}
diff --git a/src/lib/eiotas_door.c b/src/lib/eiotas_door.c
index b5fb896..20a05a5 100644
--- a/src/lib/eiotas_door.c
+++ b/src/lib/eiotas_door.c
@@ -38,7 +38,7 @@ EAPI Eiotas_Door* eiotas_door_add(const char* name, Eiotas_Room *parent, Eiotas_
void eiotas_door_free(Eiotas_Door *door)
{
- DBG("Door free 0x%X",(unsigned int)door);
+ DBG("Door free 0x%X",PRINTPTR(door));
eiotas_iota_desinit(&door->iota);
door->user_bits.free_fct(door->user_bits.data);
diff --git a/src/lib/eiotas_iota.c b/src/lib/eiotas_iota.c
index b750599..79c45b2 100644
--- a/src/lib/eiotas_iota.c
+++ b/src/lib/eiotas_iota.c
@@ -78,14 +78,14 @@ void eiotas_iota_free(Eiotas_Iota *iota)
eiotas_board_free((Eiotas_Board*)iota);
break;
default:
- CRITICAL("SPANK SPANK: 0x%X type %d is unknown, memory leak",(unsigned int)iota,iota->type);
+ CRITICAL("SPANK SPANK: 0x%X type %d is unknown, memory leak",PRINTPTR(iota),iota->type);
break;
}
}
EAPI void eiotas_iota_show(Eiotas_Iota *iota)
{
- DBG("Iota(%d) 0x%X : %s (%s) [0x%X] {0x%X}",iota->type,(unsigned int)iota,iota->name,iota->path,
- (unsigned int)iota->parent,(unsigned int)iota->spin);
+ DBG("Iota(%d) 0x%X : %s (%s) [0x%X] {0x%X}",iota->type,PRINTPTR(iota),iota->name,iota->path,
+ PRINTPTR(iota->parent),PRINTPTR(iota->spin));
}
diff --git a/src/lib/eiotas_link.c b/src/lib/eiotas_link.c
index 82a5128..96cdab6 100644
--- a/src/lib/eiotas_link.c
+++ b/src/lib/eiotas_link.c
@@ -21,7 +21,7 @@
void eiotas_link_free(Eiotas_Link *link)
{
- DBG("Link free 0x%X",(unsigned int)link);
+ DBG("Link free 0x%X",PRINTPTR(link));
// TODO
}
diff --git a/src/lib/eiotas_particle.c b/src/lib/eiotas_particle.c
index 769321e..63b9a75 100644
--- a/src/lib/eiotas_particle.c
+++ b/src/lib/eiotas_particle.c
@@ -28,7 +28,7 @@ Eiotas_Particle* eiotas_particle_alloc()
void eiotas_particle_free(Eiotas_Particle *particle)
{
- DBG("Particle free 0x%X",(unsigned int)particle);
+ DBG("Particle free 0x%X",PRINTPTR(particle));
free(particle);
}
diff --git a/src/lib/eiotas_private.h b/src/lib/eiotas_private.h
index 7c8e9c8..64c0b90 100644
--- a/src/lib/eiotas_private.h
+++ b/src/lib/eiotas_private.h
@@ -37,6 +37,13 @@ void eiotas_iota_desinit(Eiotas_Iota *iota);
int eiotas_iota_init(Eiotas_Iota *iota, const char *name, Eiotas_Iota *parent, Eiotas_Type type);
+#undef PRINTPTR
+#ifdef __clang__
+# define PRINTPTR(_p) (unsigned int)_p
+#else
+# define PRINTPTR(_p) (_p)
+#endif
+
#define CHECK_PARENT() \
if(parent==NULL) { \
ERR("NULL parent not allowed"); \
diff --git a/src/lib/eiotas_room.c b/src/lib/eiotas_room.c
index d939dc7..3fc6a36 100644
--- a/src/lib/eiotas_room.c
+++ b/src/lib/eiotas_room.c
@@ -37,7 +37,7 @@ EAPI Eiotas_Room* eiotas_room_add(const char* name, Eiotas_Room *parent)
void eiotas_room_free(Eiotas_Room *room)
{
- DBG("Room free 0x%X",(unsigned int)room);
+ DBG("Room free 0x%X",PRINTPTR(room));
eiotas_iota_desinit(&room->iota);
// TODO room->links
diff --git a/src/lib/eiotas_spin.c b/src/lib/eiotas_spin.c
index 261b236..5d74378 100644
--- a/src/lib/eiotas_spin.c
+++ b/src/lib/eiotas_spin.c
@@ -42,7 +42,7 @@ EAPI void eiotas_spin_free(Eiotas_Spin *spin)
Eiotas_Particle *particle;
Eina_Array_Iterator iterator;
- DBG("Spin free 0x%X",(unsigned int)spin);
+ DBG("Spin free 0x%X",PRINTPTR(spin));
eiotas_iota_desinit(&spin->room.iota);
eina_hash_free(spin->room.children);
diff --git a/tests/main.c b/tests/main.c
index c6acde8..ca79301 100644
--- a/tests/main.c
+++ b/tests/main.c
@@ -3,6 +3,13 @@
#include <eina_log.h>
#include <stdio.h>
+#undef PRINTPTR
+#ifdef __clang__
+# define PRINTPTR(_p) (unsigned int)_p
+#else
+# define PRINTPTR(_p) (_p)
+#endif
+
typedef struct {
char txt[32];
int idx;
@@ -30,7 +37,7 @@ static void input_show(Input *input)
static void input_receive(const Eiotas_Door *door, Eiotas_Particle *particle, Eiotas_User_Data *data)
{
- EINA_LOG_DOM_DBG(_eiotas_log_dom,"input_receive 0x%X\n",(unsigned int)data);
+ EINA_LOG_DOM_DBG(_eiotas_log_dom,"input_receive 0x%X\n",PRINTPTR(data));
}
int main(int argc, char **argv)