Bug 1279 - regex simplification: "if (A == B) A += C - B;" -> "if (A == B) A = C;"
Summary: regex simplification: "if (A == B) A += C - B;" -> "if (A == B) A = C;"
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: regex (show other bugs)
Version: 2.3.5
: P2 normal
Target Milestone: ---
Assignee: GOTO Masanori
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-31 19:52 UTC by Paul Eggert
Modified: 2018-04-19 14:46 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
simplify update of rm_se, rm_eo (495 bytes, patch)
2005-08-31 19:53 UTC, Paul Eggert
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Eggert 2005-08-31 19:52:48 UTC
While porting the regex code to 64-bit hosts I noticed an infelicity.
The code uses the equivalent of "if (A == B) A += C - B;";
it would be simpler and faster to use "if (A == B) A = C;".
This also happens to make the later changes simpler, but I thought I'd
separate it out since it makes sense regardless of the 64-bit changes.
I'll attach a patch.
Comment 1 Paul Eggert 2005-08-31 19:53:29 UTC
Created attachment 634 [details]
simplify update of rm_se, rm_eo
Comment 2 Ulrich Drepper 2005-09-06 23:37:11 UTC
The 64-bit portability part is bogus but the optimization is of course valid.
Although the compiler already performs it.