Skip to content

Overhaul parsing of config.guess triplet string (Issue #155) - #162

Open
dmacks wants to merge 2 commits into
fink:masterfrom
dmacks:kernel-parser
Open

dmacks wants to merge 2 commits into
fink:masterfrom
dmacks:kernel-parser

Conversation

@dmacks

@dmacks dmacks commented Apr 5, 2018

Copy link
Copy Markdown
Member

Split the string into its fields then do specific tests on each (with
numeric comparison for numeric fields) instead of doing a whole-string
string regex match each time.

The second field and the first part of the third field are constants
(and if they don't match, something is badly unsupported), the most
salient detail is the second part of the third field, and the first
field only has one or two known values (depending on the second part
of the third field). That means it is inefficient to keep restarting
the regex engine at the beginning, where it usually matches, only to
usually fail towards the end.

Instead, first do string equality tests for the known bad second and
first-part-of-third fields. Then iterate through the numeric (!string)
known second-part-of-third to quickly check this highly variable
detail. Only then do a test for first field if we get that far (thanks
to lazy evaluation of conditionals). Finally, complete the numeric
comparison for known kernel subversions.

dmacks added 2 commits April 5, 2018 02:25
Split the string into its fields then do specific tests on each (with
numeric comparison for numeric fields) instead of doing a whole-string
string regex match each time.

The second field and the first part of the third field are constants
(and if they don't match, something is badly unsupported), the most
salient detail is the second part of the third field, and the first
field only has one or two known values (depending on the second part
of the third field). That means it is inefficient to keep restarting
the regex engine at the beginning, where it usually matches, only to
usually fail towards the end.

Instead, first do string equality tests for the known bad second and
first-part-of-third fields. Then iterate through the numeric (!string)
known second-part-of-third to quickly check this highly variable
detail. Only then do a test for first field if we get that far (thanks
to lazy evaluation of conditionals). Finally, complete the numeric
comparison for known kernel subversions.
@akhansen

akhansen commented Jul 7, 2018

Copy link
Copy Markdown
Member

Seems like a reasonable idea to me.

@cooljeanius

Copy link
Copy Markdown
Contributor

So... any idea about those merge conflicts?

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.

3 participants