Bug 197291 - Add WTF::findIgnoringASCIICaseWithoutLength to replace strcasestr
Summary: Add WTF::findIgnoringASCIICaseWithoutLength to replace strcasestr
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Don Olmstead
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-04-25 13:33 PDT by Don Olmstead
Modified: 2019-04-26 09:52 PDT (History)
14 users (show)

See Also:


Attachments
Patch (7.41 KB, patch)
2019-04-25 13:37 PDT, Don Olmstead
no flags Details | Formatted Diff | Diff
Patch (7.41 KB, patch)
2019-04-25 13:59 PDT, Don Olmstead
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>