X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftcon%2Ftcon.h;h=e0f84b383976c4d106e6d9fe3ee9043c449d1ed8;hb=88ed9bfe13c4bd2c72b0a2513cecf9ec0f19b792;hp=1dbadafc9726716e6d19d82794ab22b461ef4903;hpb=0ddea4131eca28437638cdaf9394324fafab33da;p=ccan diff --git a/ccan/tcon/tcon.h b/ccan/tcon/tcon.h index 1dbadafc..e0f84b38 100644 --- a/ccan/tcon/tcon.h +++ b/ccan/tcon/tcon.h @@ -321,6 +321,8 @@ * tcon_container_of() evaluates to a pointer to the container * structure. With sufficient compiler support, the pointer will be * correctly typed, and the type of @member_ptr will be verified. + * Note that const is discarded; a const @member_ptr still yields a + * non-const container (unless @canary is const). * * Returns NULL if @member_ptr is NULL. */ @@ -330,7 +332,7 @@ canary, tcon_container_of_((member_ptr), \ tcon_offset((x), canary))) -static inline void *tcon_container_of_(void *member_ptr, size_t offset) +static inline void *tcon_container_of_(const void *member_ptr, size_t offset) { return member_ptr ? (char *)member_ptr - offset : NULL; }