-
Notifications
You must be signed in to change notification settings - Fork 198
shm: use embedded private instead of pointer #1124
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
shm: use embedded private instead of pointer #1124
Conversation
The private struct is pretty small and it needs to be allocated anyways, so save an extra allocation by directly embedding it. Signed-off-by: Enrico Weigelt, metux IT consult <[email protected]>
|
|
||
|
|
||
| typedef struct _ShmScrPrivateRec { | ||
| Bool initialized; |
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.
Do we need this flag at all? It looks like it’s set, but not really used. Or it’s intended for external usage?
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.
it's supposed to protect from duplicate initialization.
the original code was looking at the pointer value, so I kept this flag for safety.
not sure whether it's really needed.
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.
Maybe print some warning (or a fatal error?) if a repeated init or deinit is attempted? To add some meaning to that flag 🙂
|
Merge Conflict found |
stefan11111
left a comment
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.
Other than what @algrid said, lgtm
|
Merge Conflict found |
6 similar comments
|
Merge Conflict found |
|
Merge Conflict found |
|
Merge Conflict found |
|
Merge Conflict found |
|
Merge Conflict found |
|
Merge Conflict found |
|
Merge Conflict found |
|
This has become obsoleted by #1236 |
The private struct is pretty small and it needs to be allocated anyways,
so save an extra allocation by directly embedding it.
Signed-off-by: Enrico Weigelt, metux IT consult [email protected]