mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 934817 - Part 1: JS_New*StringCopyN should do 0-length optimization. r=luke
This commit is contained in:
parent
d5170f6988
commit
a094223027
@ -5126,6 +5126,8 @@ JS_NewStringCopyN(JSContext *cx, const char *s, size_t n)
|
||||
{
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
if (!n)
|
||||
return cx->names().empty;
|
||||
return js_NewStringCopyN<CanGC>(cx, s, n);
|
||||
}
|
||||
|
||||
@ -5210,6 +5212,8 @@ JS_NewUCStringCopyN(JSContext *cx, const jschar *s, size_t n)
|
||||
{
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
if (!n)
|
||||
return cx->names().empty;
|
||||
return js_NewStringCopyN<CanGC>(cx, s, n);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user