xdo_search: fix improper memfrees, pre-compile regexes optimization #407
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The patch was originally from @Lekensteyn at this commit in #36, I merged it with HEAD and also made some changes.
The commit fixes #258, which is causing by freeing uninitialized
regex_t
objects due to short-circuit evaluation.The regex pre-compiled solution initializes the content of these
regex_t
objects to zero usingmemset
so thatregfree
s don't crash.In addition, the origin patch also resolves the issue of repeated error messages by compiling
regex_t
objects at start. These are all done by @Lekensteyn, awesome!Aside from resolving merging conflicts, I add
regex_t
struct for role, renamexdg_search_re
toxdg_regex_t
for style consistency and apply the changes that constantify regex_t* where applicable from @Lekensteyn.BTW, I remove the whitespaces removal code changes, I think it should be made in other commit. If there is any need, I can help with that.