mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
Bug 1306756 - Remove the JS_strdup() overload accepting a JSRuntime*; r=sfink
There's no way to get a JSRuntime* in the JS API any more.
This commit is contained in:
parent
327d256722
commit
882e2c307e
@ -1301,17 +1301,6 @@ JS_strdup(JSContext* cx, const char* s)
|
||||
return DuplicateString(cx, s).release();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(char*)
|
||||
JS_strdup(JSRuntime* rt, const char* s)
|
||||
{
|
||||
AssertHeapIsIdle(rt);
|
||||
size_t n = strlen(s) + 1;
|
||||
char* p = rt->pod_malloc<char>(n);
|
||||
if (!p)
|
||||
return nullptr;
|
||||
return static_cast<char*>(js_memcpy(p, s, n));
|
||||
}
|
||||
|
||||
#undef JS_AddRoot
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
|
@ -1592,10 +1592,6 @@ JS_updateMallocCounter(JSContext* cx, size_t nbytes);
|
||||
extern JS_PUBLIC_API(char*)
|
||||
JS_strdup(JSContext* cx, const char* s);
|
||||
|
||||
/** Duplicate a string. Does not report an error on failure. */
|
||||
extern JS_PUBLIC_API(char*)
|
||||
JS_strdup(JSRuntime* rt, const char* s);
|
||||
|
||||
/**
|
||||
* Register externally maintained GC roots.
|
||||
*
|
||||
|
@ -623,7 +623,7 @@ JSRuntime::setDefaultLocale(const char* locale)
|
||||
if (!locale)
|
||||
return false;
|
||||
resetDefaultLocale();
|
||||
defaultLocale = JS_strdup(this, locale);
|
||||
defaultLocale = JS_strdup(contextFromMainThread(), locale);
|
||||
return defaultLocale != nullptr;
|
||||
}
|
||||
|
||||
@ -650,7 +650,7 @@ JSRuntime::getDefaultLocale()
|
||||
if (!locale || !strcmp(locale, "C"))
|
||||
locale = "und";
|
||||
|
||||
char* lang = JS_strdup(this, locale);
|
||||
char* lang = JS_strdup(contextFromMainThread(), locale);
|
||||
if (!lang)
|
||||
return nullptr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user