Bug 197291

Summary: Add WTF::findIgnoringASCIICaseWithoutLength to replace strcasestr
Product: WebKit Reporter: Don Olmstead <don.olmstead>
Component: Web Template FrameworkAssignee: Don Olmstead <don.olmstead>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, benjamin, cdumez, cmarcelo, commit-queue, darin, dbates, ews-watchlist, keith_miller, mark.lam, msaboff, ross.kirsling, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Don Olmstead 2019-04-25 13:33:58 PDT
Within the JSC tests strcasestr is used. This function is not available on Windows. To support compilation on Windows we should emulate strcasestr within WTF.
Comment 1 Don Olmstead 2019-04-25 13:37:26 PDT
Created attachment 368260 [details]
Patch
Comment 2 Don Olmstead 2019-04-25 13:59:07 PDT
Created attachment 368265 [details]
Patch
Comment 3 Konstantin Tokarev 2019-04-25 14:59:59 PDT
(In reply to Don Olmstead from comment #0)
> Within the JSC tests strcasestr is used. This function is not available on
> Windows. To support compilation on Windows we should emulate strcasestr
> within WTF.

It's more convenient to have such justifications right inside commit message (and changelog). When I personally make a patch which requires justification, I first write it inside git commit message and then copy it to bugzilla as a first comment
Comment 4 Ross Kirsling 2019-04-25 15:01:50 PDT
Comment on attachment 368265 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=368265&action=review

> Source/WTF/wtf/text/StringCommon.h:469
> +inline size_t findIgnoringASCIICaseWithoutLength(const char* source, const char* matchCharacters)

Looking at the other *WithoutLength functions, I wonder if `source` should have a templated type (i.e. const StringClass&)?
Comment 5 Konstantin Tokarev 2019-04-25 15:06:09 PDT
Comment on attachment 368265 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=368265&action=review

>> Source/WTF/wtf/text/StringCommon.h:469
>> +inline size_t findIgnoringASCIICaseWithoutLength(const char* source, const char* matchCharacters)
> 
> Looking at the other *WithoutLength functions, I wonder if `source` should have a templated type (i.e. const StringClass&)?

AFAIU other *WithoutLength functions use StringClass as a placeholder of C++ string class like String or AtomicString, primitive const char* is always explicit there
Comment 6 Don Olmstead 2019-04-25 18:38:35 PDT
Comment on attachment 368265 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=368265&action=review

>>> Source/WTF/wtf/text/StringCommon.h:469
>>> +inline size_t findIgnoringASCIICaseWithoutLength(const char* source, const char* matchCharacters)
>> 
>> Looking at the other *WithoutLength functions, I wonder if `source` should have a templated type (i.e. const StringClass&)?
> 
> AFAIU other *WithoutLength functions use StringClass as a placeholder of C++ string class like String or AtomicString, primitive const char* is always explicit there

Also strlen needs to be called.
Comment 7 WebKit Commit Bot 2019-04-26 09:51:55 PDT
Comment on attachment 368265 [details]
Patch

Clearing flags on attachment: 368265

Committed r244694: <https://trac.webkit.org/changeset/244694>
Comment 8 WebKit Commit Bot 2019-04-26 09:51:57 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2019-04-26 09:52:17 PDT
<rdar://problem/50245918>