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

[discussion] struct info free/no-free sets #411

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bp0
Copy link
Collaborator

@bp0 bp0 commented Jul 7, 2019

@lpereira, what do you think about just having two sets for name, value, icon, tag, where one set is const and the other always gets freed? The the proper member can just be set for whichever is appropriate. If the string should be owned by the info field struct set .name, if not set .name_const, etc, This replaces the free_on_flatten members for each one. The info_field_get_*() macros return whichever is set for convenience.
This PR implements the idea in info.{h,c} but doesn't change any uses of it, so don't expect it to compile.

@lpereira
Copy link
Owner

We can make everything non-const and just have a boolean to free -- a lot of places will copy the Info struct, and pointers are bigger; booleans are 1-byte only (barring alignment issues), so should be slightly better.

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.

None yet

2 participants