#406: more uses of vmx_memchr() converted

This commit is contained in:
Cameron Kaiser 2017-06-27 22:28:09 -07:00
parent e5108cf1ca
commit 84d75d8756
3 changed files with 13 additions and 4 deletions

View File

@ -50,6 +50,9 @@
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include "mozilla-config.h"
#include "plvmx.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::gfx; using namespace mozilla::gfx;
using namespace mozilla::unicode; using namespace mozilla::unicode;
@ -2742,7 +2745,7 @@ inline static bool IsChar8Bit(char16_t aCh) { return aCh < 0x100; }
inline static bool HasSpaces(const uint8_t *aString, uint32_t aLen) inline static bool HasSpaces(const uint8_t *aString, uint32_t aLen)
{ {
return memchr(aString, 0x20, aLen) != nullptr; return VMX_MEMCHR(aString, 0x20, aLen) != nullptr;
} }
inline static bool HasSpaces(const char16_t *aString, uint32_t aLen) inline static bool HasSpaces(const char16_t *aString, uint32_t aLen)

View File

@ -80,6 +80,9 @@
#include "GeckoProfiler.h" #include "GeckoProfiler.h"
#include "mozilla-config.h"
#include "plvmx.h"
#ifdef DEBUG #ifdef DEBUG
#undef NOISY_REFLOW #undef NOISY_REFLOW
#undef NOISY_TRIM #undef NOISY_TRIM
@ -2891,7 +2894,7 @@ static int32_t FindChar(const nsTextFragment* frag,
} else { } else {
if (uint16_t(ch) <= 0xFF) { if (uint16_t(ch) <= 0xFF) {
const char* str = frag->Get1b() + aOffset; const char* str = frag->Get1b() + aOffset;
const void* p = memchr(str, ch, aLength); const void* p = VMX_MEMCHR(str, ch, aLength);
if (p) if (p)
return (static_cast<const char*>(p) - str) + aOffset; return (static_cast<const char*>(p) - str) + aOffset;
} }

View File

@ -12,6 +12,9 @@
#include "nscore.h" // for |char16_t| #include "nscore.h" // for |char16_t|
#include "mozilla-config.h"
#include "plvmx.h" // for |vmx_memchr| (if implemented)
// This file may be used (through nsUTF8Utils.h) from non-XPCOM code, in // This file may be used (through nsUTF8Utils.h) from non-XPCOM code, in
// particular the standalone software updater. In that case stub out // particular the standalone software updater. In that case stub out
// the macros provided by nsDebug.h which are only usable when linking XPCOM // the macros provided by nsDebug.h which are only usable when linking XPCOM
@ -501,8 +504,8 @@ struct nsCharTraits<char>
static const char_type* static const char_type*
find(const char_type* aStr, size_t aN, char_type aChar) find(const char_type* aStr, size_t aN, char_type aChar)
{ {
return reinterpret_cast<const char_type*>(memchr(aStr, to_int_type(aChar), return reinterpret_cast<const char_type*>(VMX_MEMCHR(aStr, to_int_type(aChar),
aN)); aN));
} }
}; };