chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8b42f5e
)
process-util: replace PTR_TO_PID() and PID_TO_PTR macro by inline functions
author
Lennart Poettering
<lennart@poettering.net>
Thu, 11 Jan 2018 15:02:13 +0000
(16:02 +0100)
committer
Sven Eden
<yamakuzure@gmx.net>
Wed, 30 May 2018 05:50:14 +0000
(07:50 +0200)
This way we gain some typesafety at no cost.
src/basic/process-util.h
patch
|
blob
|
history
diff --git
a/src/basic/process-util.h
b/src/basic/process-util.h
index 7942d36e600e6c58b6bd409a3dc83b66f6b6a207..2ccb8e8f39a2a3b591b859da9537f135cef7d7a2 100644
(file)
--- a/
src/basic/process-util.h
+++ b/
src/basic/process-util.h
@@
-126,8
+126,13
@@
int sched_policy_to_string_alloc(int i, char **s);
int sched_policy_from_string(const char *s);
#endif // 0
-#define PTR_TO_PID(p) ((pid_t) ((uintptr_t) p))
-#define PID_TO_PTR(p) ((void*) ((uintptr_t) p))
+static inline pid_t PTR_TO_PID(const void *p) {
+ return (pid_t) ((uintptr_t) p);
+}
+
+static inline void* PID_TO_PTR(pid_t pid) {
+ return (void*) ((uintptr_t) pid);
+}
void valgrind_summary_hack(void);