-
Notifications
You must be signed in to change notification settings - Fork 242
Use named fields for match frame members #848
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
Conversation
2ddd780 to
ea954db
Compare
| mb->true_end_subject = mb->end_subject + P->temp_size; | ||
| Feptr = P->temp_sptr[1]; | ||
| F->fields.op_assert_scs.saved_end_subject = mb->end_subject; | ||
| mb->end_subject = P->fields.op_assert_scs.saved_end_subject; |
Check warning
Code scanning / clang
Dereference of null pointer Warning
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.
We can just ignore this. Clang's static analyzer is usually very helpful, but it has some spammy false positives in this file, due to the goto-based architecture. It thinks it's possible for there to be NULLs, because it can't follow all the conditions across the gotos.
NWilson
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.
I like it! Better names is good.
| #define Lmin F->fields.char_repeat.min | ||
| #define Lmax F->fields.char_repeat.max | ||
| #define Lc F->fields.char_repeat.c | ||
| #define Loc F->fields.char_repeat.oc |
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 you know why some of the defines are "Lsomething" and some are "Fsomething"? Is it just inconsistent naming?
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 suspect L is local, and F is frame. So L-s may or many not present in a frame, but F-s are always present and have the same meaning. Of course only @PhilipHazel knows the exact meaning. :)
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.
@zherczeg is correct. The naming is definitely deliberate. There is this comment in the code:
/* Define short names for general fields in the current backtrack frame, which
is always pointed to by the F variable. Occasional references to fields in
other frames are written out explicitly. There are also some fields in the
current frame whose names start with "temp" that are used for short-term,
localised backtracking memory. These are #defined with Lxxx names at the point
of use and undefined afterwards. */
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 have updated the comments.
| mb->true_end_subject = mb->end_subject + P->temp_size; | ||
| Feptr = P->temp_sptr[1]; | ||
| F->fields.op_assert_scs.saved_end_subject = mb->end_subject; | ||
| mb->end_subject = P->fields.op_assert_scs.saved_end_subject; |
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.
We can just ignore this. Clang's static analyzer is usually very helpful, but it has some spammy false positives in this file, due to the goto-based architecture. It thinks it's possible for there to be NULLs, because it can't follow all the conditions across the gotos.
ea954db to
d341ade
Compare
I hoped the memory can be reduced this way, but no luck so far. The size before
eptris 80 bytes before and after the patch, since char_repeat uses all members. However, due to using a struct type, we might be able to reduce the size of some members in the future.