mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1033959 - Don't use wmemchr when string matching on Windows, r=luke
This commit is contained in:
parent
8420d55ed6
commit
8b637f5795
@ -27,7 +27,6 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jsarray.h"
|
||||
@ -1168,22 +1167,12 @@ FirstCharMatcher8bit(const char *text, uint32_t n, const char pat)
|
||||
}
|
||||
|
||||
static const jschar *
|
||||
FirstCharMatcher16bit (const jschar *text, uint32_t n, const jschar pat)
|
||||
FirstCharMatcher16bit(const jschar *text, uint32_t n, const jschar pat)
|
||||
{
|
||||
/* Some platforms define wchar_t as signed and others not. */
|
||||
#if (WCHAR_MIN == 0 && WCHAR_MAX == UINT16_MAX) || (WCHAR_MIN == INT16_MIN && WCHAR_MAX == INT16_MAX)
|
||||
#if defined(XP_DARWIN) || defined(XP_WIN)
|
||||
/*
|
||||
* Wmemchr works the best.
|
||||
* But only possible to use this when,
|
||||
* size of jschar = size of wchar_t.
|
||||
*/
|
||||
const wchar_t *wtext = (const wchar_t *) text;
|
||||
const wchar_t wpat = (const wchar_t) pat;
|
||||
return (jschar *) (wmemchr(wtext, wpat, n));
|
||||
#elif defined(__clang__)
|
||||
/*
|
||||
* Performance under memchr is horrible in clang.
|
||||
* Hence it is best to use UnrolledMatcher in this case
|
||||
* Performance of memchr is horrible in OSX. Windows is better,
|
||||
* but it is still better to use UnrolledMatcher.
|
||||
*/
|
||||
return FirstCharMatcherUnrolled<jschar, jschar>(text, n, pat);
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user