[pcre-dev] [Bug 1120] New: Compactifty code

Top Page
Delete this message
Author: Vladimir
Date:  
To: pcre-dev
New-Topics: [pcre-dev] [Bug 1120] Compactifty code
Subject: [pcre-dev] [Bug 1120] New: Compactifty code
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1120
           Summary: Compactifty code
           Product: PCRE
           Version: 8.12
          Platform: x86
        OS/Version: All
            Status: NEW
          Severity: wishlist
          Priority: low
         Component: Code
        AssignedTo: ph10@???
        ReportedBy: blueboar_2@???
                CC: pcre-dev@???



In compile2() there is such thing:

switch (options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE))
{
case 0:
case PCRE_BSR_ANYCRLF:
case PCRE_BSR_UNICODE:
break;
default: errorcode = ERR56; goto PCRE_EARLY_ERROR_RETURN;
}

Why so big?
Can't it be simply

if options & (PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE) =
PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE then ... error

or

options | ANYCRLF | UNICODE = options then ERROR!!!

Why so much switch and cases?

(BTW compiler does not optimize this, i've checked in Debian udeb package - it
checks all possibilities. Even worse, it first checks CRLF, then UNICODE, and
only then that both are unset - most common situation. Why he does it - i don't
know)

PS: I know, it doesn't make PCRE significally faster, but it is more beautiful,
mode compact, and more faster, even several nanoseconds.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email