macro: add PTR_TO_INT() and INT_TO_PTR()

parent ceecb90e
......@@ -29,9 +29,6 @@
#include <unistd.h>
#include "lxccontainer.h"
/* https://developer.gnome.org/glib/2.28/glib-Type-Conversion-Macros.html */
#define INT_TO_PTR(n) ((void *)(long)(n))
#define PTR_TO_INT(p) ((int)(long)(p))
#include "macro.h"
#include "state.h"
......
......@@ -27,6 +27,7 @@
#include <linux/loop.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <stdint.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/socket.h>
......@@ -266,4 +267,8 @@ extern int __build_bug_on_failed;
#define SOCK_CLOEXEC 02000000
#endif
/* pointer conversion macros */
#define PTR_TO_INT(p) ((int)((intptr_t)(p)))
#define INT_TO_PTR(u) ((void *)((intptr_t)(u)))
#endif /* __LXC_MACRO_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment