git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
eal: fix container_of macro for const members
[dpdk.git]
/
lib
/
librte_eal
/
common
/
include
/
rte_common.h
diff --git
a/lib/librte_eal/common/include/rte_common.h
b/lib/librte_eal/common/include/rte_common.h
index
8dda3e2
..
c421708
100644
(file)
--- a/
lib/librte_eal/common/include/rte_common.h
+++ b/
lib/librte_eal/common/include/rte_common.h
@@
-347,8
+347,9
@@
rte_bsf32(uint32_t v)
*/
#ifndef container_of
#define container_of(ptr, type, member) __extension__ ({ \
*/
#ifndef container_of
#define container_of(ptr, type, member) __extension__ ({ \
- typeof(((type *)0)->member) *_ptr = (ptr); \
- (type *)(((char *)_ptr) - offsetof(type, member)); })
+ const typeof(((type *)0)->member) *_ptr = (ptr); \
+ (type *)(((uintptr_t)_ptr) - offsetof(type, member)); \
+ })
#endif
#define _RTE_STR(x) #x
#endif
#define _RTE_STR(x) #x