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

Move as much data as possible into non-writable text by declaring it const #46

Merged
merged 6 commits into from
Oct 13, 2014
Merged

Move as much data as possible into non-writable text by declaring it const #46

merged 6 commits into from
Oct 13, 2014

Conversation

wiml
Copy link
Contributor

@wiml wiml commented Aug 4, 2014

While reviewing this for threadsafety I noticed a lot of internal tables were in the (read/write) data section instead of the (read-only) text section. This pull request declares everything that is actually constant as 'const', which both makes it clear to the reader that there is not a threadsafety issue, and helps the compiler enforce this invariant, and is a (slight) performance win. This pull request touches a lot of lines but each individual commit should be small enough to review easily.

Most of the remaining global mutable variables are the asn_TYPE_descriptor_t and asn_TYPE_member_t structures, since those actually are fixed up at runtime for inherited types.

vlm added a commit that referenced this pull request Oct 13, 2014
Move as much data as possible into non-writable text by declaring it const
@vlm vlm merged commit 78d604f into vlm:master Oct 13, 2014
@vlm
Copy link
Owner

vlm commented Oct 13, 2014

Thank you!

@wiml wiml deleted the constify branch March 24, 2015 20:44
velichkov pushed a commit to velichkov/asn1c that referenced this pull request Jun 19, 2019
* tests using readdir and other
  filesystem related functions fail
  when using 32bit crossdev
  environment without these changes
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