Skip to content
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

Type-checking container_of macro #25

Merged
merged 1 commit into from
Feb 23, 2024
Merged

Type-checking container_of macro #25

merged 1 commit into from
Feb 23, 2024

Conversation

aiw-panasonic
Copy link
Collaborator

It is an error to invoke the container_of() macro with a ptr parameter that is not of type pointer-to-member. But the macro hides that error by ignoring the 'ptr' type.

Make the macro safer by requiring ptr to have the correct type.

Also, rename it to er_container_of(), to avoid potential name collisions with other container_of() macros.

It is an error to invoke the container_of() macro with a
`ptr` parameter that is not of type pointer-to-`member`.
But the macro hides that error by ignoring the 'ptr' type.

Make the macro safer by requiring `ptr` to have the
correct type.

Also, rename it to er_container_of(), to avoid potential
name collisions with other container_of() macros.
@aiw-panasonic aiw-panasonic marked this pull request as ready for review February 22, 2024 21:52
@aiw-panasonic aiw-panasonic merged commit 77e273e into main Feb 23, 2024
1 check passed
@aiw-panasonic aiw-panasonic deleted the aiw-container-of branch February 23, 2024 01:46
@aiw-panasonic aiw-panasonic removed the request for review from jd-yolabs February 23, 2024 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants