-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
opal,ompi: move container_of definition to its own header #12724
Conversation
9918983
to
1d112bd
Compare
@jsquyres I touched usnic for this PR so it would be great to have your eyes. |
1d112bd
to
f462fe0
Compare
BEGIN_C_DECLS | ||
|
||
#ifndef container_of | ||
# define container_of(ptr, type, member) ((type *) (((char *) (ptr)) - offsetof(type, member))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we namespace this to opal_container_of
so that there is no conflict if another project has the brilliant idea of providing their own copy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmmm container_of is quite common in the wild and we are actually not making a fancier option than the default one, so I'm inclined to keep the name(also we are doing ifndef so it should be safe).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed the #ifndef
so I guess it's fine and keeps the impact small.
Centralize container_of macro definition so that we don't have to define it everywhere. Signed-off-by: Wenduo Wang <[email protected]>
f462fe0
to
8acb59d
Compare
BEGIN_C_DECLS | ||
|
||
#ifndef container_of | ||
# define container_of(ptr, type, member) ((type *) (((char *) (ptr)) - offsetof(type, member))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed the #ifndef
so I guess it's fine and keeps the impact small.
I'm running more tests. Will open backports today. |
Centralize container_of macro definition so that we don't have to define it everywhere.