зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1283924 - Add NewLatin1StringZ (r=jandem)
MozReview-Commit-ID: FSJuXAunBni --HG-- extra : rebase_source : 95d42b15c8b95afc4579deff67683f0091836136
This commit is contained in:
Родитель
d7a0b010ae
Коммит
6f3f4fb97a
|
@ -11,6 +11,7 @@
|
|||
#include "mozilla/PodOperations.h"
|
||||
#include "mozilla/RangedPtr.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
#include "mozilla/unused.h"
|
||||
|
||||
#include "gc/Marking.h"
|
||||
#include "js/UbiNode.h"
|
||||
|
@ -1269,6 +1270,17 @@ NewStringCopyNDontDeflate<CanGC>(ExclusiveContext* cx, const Latin1Char* s, size
|
|||
template JSFlatString*
|
||||
NewStringCopyNDontDeflate<NoGC>(ExclusiveContext* cx, const Latin1Char* s, size_t n);
|
||||
|
||||
JSFlatString*
|
||||
NewLatin1StringZ(ExclusiveContext* cx, UniqueChars chars)
|
||||
{
|
||||
JSFlatString* str = NewString<CanGC>(cx, (Latin1Char*)chars.get(), strlen(chars.get()));
|
||||
if (!str)
|
||||
return nullptr;
|
||||
|
||||
mozilla::Unused << chars.release();
|
||||
return str;
|
||||
}
|
||||
|
||||
template <AllowGC allowGC, typename CharT>
|
||||
JSFlatString*
|
||||
NewStringCopyN(ExclusiveContext* cx, const CharT* s, size_t n)
|
||||
|
|
|
@ -1174,6 +1174,10 @@ NewStringDontDeflate(js::ExclusiveContext* cx, CharT* chars, size_t length);
|
|||
extern JSLinearString*
|
||||
NewDependentString(JSContext* cx, JSString* base, size_t start, size_t length);
|
||||
|
||||
/* Take ownership of an array of Latin1Chars. */
|
||||
extern JSFlatString*
|
||||
NewLatin1StringZ(js::ExclusiveContext* cx, UniqueChars chars);
|
||||
|
||||
/* Copy a counted string and GC-allocate a descriptor for it. */
|
||||
template <js::AllowGC allowGC, typename CharT>
|
||||
extern JSFlatString*
|
||||
|
|
Загрузка…
Ссылка в новой задаче