Bug 784739 - Switch from NULL to nullptr in js/src/ (1/9); r=ehsan

--HG--
extra : rebase_source : 358fd557136a4c12a3a374657050279d1bdeedfa
This commit is contained in:
Birunthan Mohanathas 2013-10-07 12:42:55 -04:00
Родитель 37f8167fb8
Коммит 075a3ea1b6
13 изменённых файлов: 199 добавлений и 198 удалений

Просмотреть файл

@ -90,17 +90,17 @@ const char* const TraceLogging::typeName[] = {
"e,b", // engine baseline
"e,o" // engine ionmonkey
};
TraceLogging* TraceLogging::loggers[] = {NULL, NULL, NULL};
TraceLogging* TraceLogging::loggers[] = {nullptr, nullptr, nullptr};
bool TraceLogging::atexitSet = false;
uint64_t TraceLogging::startupTime = 0;
TraceLogging::TraceLogging(Logger id)
: nextTextId(1),
entries(NULL),
entries(nullptr),
curEntry(0),
numEntries(1000000),
fileno(0),
out(NULL),
out(nullptr),
id(id)
{
textMap.init();
@ -111,12 +111,12 @@ TraceLogging::~TraceLogging()
if (entries) {
flush();
free(entries);
entries = NULL;
entries = nullptr;
}
if (out) {
fclose(out);
out = NULL;
out = nullptr;
}
}
@ -137,7 +137,7 @@ TraceLogging::grow()
}
void
TraceLogging::log(Type type, const char* text /* = NULL */, unsigned int number /* = 0 */)
TraceLogging::log(Type type, const char* text /* = nullptr */, unsigned int number /* = 0 */)
{
uint64_t now = rdtsc() - startupTime;
@ -149,7 +149,7 @@ TraceLogging::log(Type type, const char* text /* = NULL */, unsigned int number
}
uint32_t textId = 0;
char *text_ = NULL;
char *text_ = nullptr;
if (text) {
TextHashMap::AddPtr p = textMap.lookupForAdd(text);
@ -248,9 +248,9 @@ TraceLogging::flush()
exit(-1);
}
if (entries[i].text() != NULL) {
if (entries[i].text() != nullptr) {
free(entries[i].text());
entries[i].text_ = NULL;
entries[i].text_ = nullptr;
}
}
curEntry = 0;
@ -279,7 +279,7 @@ TraceLogging::releaseLoggers()
continue;
delete loggers[i];
loggers[i] = NULL;
loggers[i] = nullptr;
}
}

Просмотреть файл

@ -102,7 +102,7 @@ class TraceLogging
TraceLogging(Logger id);
~TraceLogging();
void log(Type type, const char* text = NULL, unsigned int number = 0);
void log(Type type, const char* text = nullptr, unsigned int number = 0);
void log(Type type, const JS::CompileOptions &options);
void log(Type type, JSScript* script);
void log(const char* log);

Просмотреть файл

@ -830,7 +830,7 @@ DumpHeapComplete(JSContext *cx, unsigned argc, jsval *vp)
CallArgs args = CallArgsFromVp(argc, vp);
DumpHeapNurseryBehaviour nurseryBehaviour = js::IgnoreNurseryObjects;
FILE *dumpFile = NULL;
FILE *dumpFile = nullptr;
unsigned i = 0;
if (argc > i) {

Просмотреть файл

@ -5081,7 +5081,7 @@ class ParallelCompilationGuard
{
WorkerThreadState *parallelState_;
public:
ParallelCompilationGuard() : parallelState_(NULL) {}
ParallelCompilationGuard() : parallelState_(nullptr) {}
~ParallelCompilationGuard() {
if (parallelState_) {
JS_ASSERT(parallelState_->asmJSCompilationInProgress == true);

Просмотреть файл

@ -7777,7 +7777,7 @@ IonBuilder::freezePropTypeSets(types::TemporaryTypeSet *types,
continue;
// Walk the prototype chain. Everyone has to have the property, since we
// just checked, so propSet cannot be NULL.
// just checked, so propSet cannot be nullptr.
while (true) {
types::HeapTypeSetKey property = type->property(NameToId(name));
JS_ALWAYS_TRUE(!property.notEmpty(constraints()));

Просмотреть файл

@ -687,7 +687,7 @@ class IonBuilder : public MIRGenerator
}
bool isInlineBuilder() const {
return callerBuilder_ != NULL;
return callerBuilder_ != nullptr;
}
private:

Просмотреть файл

@ -273,8 +273,8 @@ class Range : public TempObject {
// Construct a range from the given raw values.
Range(int32_t l, bool lb, int32_t h, bool hb, bool f, uint16_t e)
: symbolicLower_(NULL),
symbolicUpper_(NULL)
: symbolicLower_(nullptr),
symbolicUpper_(nullptr)
{
rawInitialize(l, lb, h, hb, f, e);
}

Просмотреть файл

@ -53,14 +53,14 @@ class TempAllocPolicy
void *malloc_(size_t bytes) {
void *p = js_malloc(bytes);
if (JS_UNLIKELY(!p))
p = onOutOfMemory(NULL, bytes);
p = onOutOfMemory(nullptr, bytes);
return p;
}
void *calloc_(size_t bytes) {
void *p = js_calloc(bytes);
if (JS_UNLIKELY(!p))
p = onOutOfMemory(NULL, bytes);
p = onOutOfMemory(nullptr, bytes);
return p;
}

Просмотреть файл

@ -440,7 +440,7 @@ ScriptAnalysis::analyzeLifetimes(JSContext *cx)
}
unsigned savedCount = 0;
LoopAnalysis *loop = NULL;
LoopAnalysis *loop = nullptr;
uint32_t offset = script_->length - 1;
while (offset < script_->length) {
@ -525,7 +525,7 @@ ScriptAnalysis::analyzeLifetimes(JSContext *cx)
setOOM(cx);
return;
}
var.saved = NULL;
var.saved = nullptr;
saved[i--] = saved[--savedCount];
}
savedCount = 0;
@ -617,7 +617,7 @@ ScriptAnalysis::analyzeLifetimes(JSContext *cx)
setOOM(cx);
return;
}
var.saved = NULL;
var.saved = nullptr;
saved[i--] = saved[--savedCount];
} else if (loop && !var.savedEnd) {
/*
@ -680,7 +680,7 @@ ScriptAnalysis::addVariable(JSContext *cx, LifetimeVariable &var, unsigned offse
setOOM(cx);
return;
}
var.saved = NULL;
var.saved = nullptr;
}
}
@ -730,7 +730,7 @@ ScriptAnalysis::killVariable(JSContext *cx, LifetimeVariable &var, unsigned offs
} else {
var.saved = var.lifetime;
var.savedEnd = 0;
var.lifetime = NULL;
var.lifetime = nullptr;
saved[savedCount++] = &var;
}
@ -1510,7 +1510,7 @@ ScriptAnalysis::freezeNewValues(JSContext *cx, uint32_t offset)
Bytecode &code = getCode(offset);
Vector<SlotValue> *pending = code.pendingValues;
code.pendingValues = NULL;
code.pendingValues = nullptr;
unsigned count = pending->length();
if (count == 0) {

Просмотреть файл

@ -336,7 +336,7 @@ struct LifetimeVariable
return segment;
segment = segment->next;
}
return NULL;
return nullptr;
}
/*

Просмотреть файл

@ -230,7 +230,8 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for
JS_snprintf(numBuf, sizeof numBuf, "%u", argc);
JSAutoByteString funNameBytes;
if (const char *name = GetFunctionNameBytes(cx, fun, &funNameBytes)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JSMSG_MORE_ARGS_NEEDED,
name, numBuf, (argc == 1) ? "" : "s");
}
}
@ -309,7 +310,7 @@ JS_ConvertArgumentsVA(JSContext *cx, unsigned argc, jsval *argv, const char *for
case '*':
break;
default:
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_CHAR, format);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_CHAR, format);
return false;
}
sp++;
@ -346,11 +347,11 @@ JS_ConvertValue(JSContext *cx, HandleValue value, JSType type, MutableHandleValu
case JSTYPE_FUNCTION:
vp.set(value);
obj = ReportIfNotFunction(cx, vp);
ok = (obj != NULL);
ok = (obj != nullptr);
break;
case JSTYPE_STRING:
str = ToString<CanGC>(cx, value);
ok = (str != NULL);
ok = (str != nullptr);
if (ok)
vp.setString(str);
break;
@ -365,7 +366,7 @@ JS_ConvertValue(JSContext *cx, HandleValue value, JSType type, MutableHandleValu
default: {
char numBuf[12];
JS_snprintf(numBuf, sizeof numBuf, "%d", (int)type);
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_TYPE, numBuf);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_TYPE, numBuf);
ok = false;
break;
}
@ -537,7 +538,7 @@ JS_PUBLIC_API(const char *)
JS_GetTypeName(JSContext *cx, JSType type)
{
if ((unsigned)type >= (unsigned)JSTYPE_LIMIT)
return NULL;
return nullptr;
return TypeStrings[type];
}
@ -714,11 +715,11 @@ JS_NewRuntime(uint32_t maxbytes, JSUseHelperThreads useHelperThreads)
JSRuntime *rt = js_new<JSRuntime>(useHelperThreads);
if (!rt)
return NULL;
return nullptr;
if (!rt->init(maxbytes)) {
JS_DestroyRuntime(rt);
return NULL;
return nullptr;
}
return rt;
@ -739,7 +740,7 @@ JS_SetICUMemoryFunctions(JS_ICUAllocFn allocFn, JS_ICUReallocFn reallocFn, JS_IC
#if EXPOSE_INTL_API
UErrorCode status = U_ZERO_ERROR;
u_setMemoryFunctions(/* context = */ NULL, allocFn, reallocFn, freeFn, &status);
u_setMemoryFunctions(/* context = */ nullptr, allocFn, reallocFn, freeFn, &status);
return U_SUCCESS(status);
#else
return true;
@ -919,7 +920,7 @@ static const struct v2smap {
{JSVERSION_DEFAULT, "1.3"},
{JSVERSION_DEFAULT, "1.4"},
{JSVERSION_DEFAULT, "1.5"},
{JSVERSION_UNKNOWN, NULL}, /* must be last, NULL is sentinel */
{JSVERSION_UNKNOWN, nullptr}, /* must be last, nullptr is sentinel */
};
JS_PUBLIC_API(const char *)
@ -1382,7 +1383,7 @@ static const JSStdName standard_class_atoms[] = {
#ifdef ENABLE_BINARYDATA
{js_InitTypedObjectClasses, EAGER_ATOM_AND_CLASP(Type)},
#endif
{NULL, 0, NULL}
{nullptr, 0, nullptr}
};
/*
@ -1449,7 +1450,7 @@ static const JSStdName standard_class_names[] = {
{js_InitTypedObjectClasses, EAGER_CLASS_ATOM(ArrayType), &js::ArrayType::class_},
{js_InitTypedObjectClasses, EAGER_CLASS_ATOM(StructType), &js::StructType::class_},
#endif
{NULL, 0, NULL}
{nullptr, 0, nullptr}
};
static const JSStdName object_prototype_names[] = {
@ -1475,7 +1476,7 @@ static const JSStdName object_prototype_names[] = {
{js_InitObjectClass, EAGER_ATOM(lookupSetter), &JSObject::class_},
#endif
{NULL, 0, NULL}
{nullptr, 0, nullptr}
};
#undef CLASP
@ -1515,7 +1516,7 @@ JS_ResolveStandardClass(JSContext *cx, HandleObject obj, HandleId id, bool *reso
}
/* Try for class constructors/prototypes named by well-known atoms. */
stdnm = NULL;
stdnm = nullptr;
for (i = 0; standard_class_atoms[i].init; i++) {
JS_ASSERT(standard_class_atoms[i].clasp);
atom = OFFSET_TO_NAME(rt, standard_class_atoms[i].atomOffset);
@ -1699,7 +1700,7 @@ JS::CurrentGlobalOrNull(JSContext *cx)
AssertHeapIsIdleOrIterating(cx);
CHECK_REQUEST(cx);
if (!cx->compartment())
return NULL;
return nullptr;
return cx->global();
}
@ -1768,7 +1769,7 @@ JS_strdup(JSRuntime *rt, const char *s)
size_t n = strlen(s) + 1;
void *p = rt->malloc_(n);
if (!p)
return NULL;
return nullptr;
return static_cast<char*>(js_memcpy(p, s, n));
}
@ -1779,7 +1780,7 @@ JS_AddValueRoot(JSContext *cx, jsval *vp)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
return AddValueRoot(cx, vp, NULL);
return AddValueRoot(cx, vp, nullptr);
}
JS_PUBLIC_API(bool)
@ -1787,7 +1788,7 @@ JS_AddStringRoot(JSContext *cx, JSString **rp)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
return AddStringRoot(cx, rp, NULL);
return AddStringRoot(cx, rp, nullptr);
}
JS_PUBLIC_API(bool)
@ -1795,7 +1796,7 @@ JS_AddObjectRoot(JSContext *cx, JSObject **rp)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
return AddObjectRoot(cx, rp, NULL);
return AddObjectRoot(cx, rp, nullptr);
}
JS_PUBLIC_API(bool)
@ -1991,7 +1992,7 @@ DumpNotify(JSTracer *trc, void **thingp, JSGCTraceKind kind)
node->thing = thing;
node->kind = kind;
node->next = NULL;
node->next = nullptr;
node->parent = dtrc->parentNode;
js_memcpy(node->edgeName, edgeName, edgeNameSize);
@ -2020,7 +2021,7 @@ DumpNode(JSDumpingTracer *dtrc, FILE* fp, JSHeapDumpNode *node)
* chain order.
*/
chainLimit = MAX_PARENTS_TO_PRINT;
prev = NULL;
prev = nullptr;
for (;;) {
following = node->parent;
node->parent = prev;
@ -2080,8 +2081,8 @@ JS_DumpHeap(JSRuntime *rt, FILE *fp, void* startThing, JSGCTraceKind startKind,
dtrc.startThing = startThing;
dtrc.thingToFind = thingToFind;
dtrc.thingToIgnore = thingToIgnore;
dtrc.parentNode = NULL;
JSHeapDumpNode *node = NULL;
dtrc.parentNode = nullptr;
JSHeapDumpNode *node = nullptr;
dtrc.lastNodep = &node;
if (!startThing) {
JS_ASSERT(startKind == JSTRACE_OBJECT);
@ -2102,7 +2103,7 @@ JS_DumpHeap(JSRuntime *rt, FILE *fp, void* startThing, JSGCTraceKind startKind,
* so far.
*/
if (dtrc.ok) {
if (thingToFind == NULL || thingToFind == node->thing)
if (thingToFind == nullptr || thingToFind == node->thing)
dtrc.ok = DumpNode(&dtrc, fp, node);
/* Descend into children. */
@ -2110,12 +2111,12 @@ JS_DumpHeap(JSRuntime *rt, FILE *fp, void* startThing, JSGCTraceKind startKind,
depth < maxDepth &&
(thingToFind != node->thing || !thingToFindWasTraced)) {
dtrc.parentNode = node;
children = NULL;
children = nullptr;
dtrc.lastNodep = &children;
JS_TraceChildren(&dtrc.base, node->thing, node->kind);
if (thingToFind == node->thing)
thingToFindWasTraced = true;
if (children != NULL) {
if (children != nullptr) {
++depth;
node = children;
continue;
@ -2454,7 +2455,7 @@ JS_DefaultValue(JSContext *cx, JSObject *objArg, JSType hint, jsval *vp)
RootedObject obj(cx, objArg);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
JS_ASSERT(obj != NULL);
JS_ASSERT(obj != nullptr);
JS_ASSERT(hint == JSTYPE_VOID || hint == JSTYPE_STRING || hint == JSTYPE_NUMBER);
RootedValue value(cx);
@ -2583,7 +2584,7 @@ JS_GetInstancePrivate(JSContext *cx, JSObject *objArg, const JSClass *clasp, jsv
{
RootedObject obj(cx, objArg);
if (!JS_InstanceOf(cx, obj, clasp, argv))
return NULL;
return nullptr;
return obj->getPrivate();
}
@ -2637,12 +2638,12 @@ JS_GetConstructor(JSContext *cx, JSObject *protoArg)
JSAutoResolveFlags rf(cx, 0);
if (!JSObject::getProperty(cx, proto, proto, cx->names().constructor, &cval))
return NULL;
return nullptr;
}
if (!IsFunctionObject(cval)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NO_CONSTRUCTOR,
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NO_CONSTRUCTOR,
proto->getClass()->name);
return NULL;
return nullptr;
}
return &cval.toObject();
}
@ -2710,13 +2711,13 @@ JS_NewGlobalObject(JSContext *cx, const JSClass *clasp, JSPrincipals *principals
if (options.zoneSpecifier() == JS::SystemZone)
zone = rt->systemZone;
else if (options.zoneSpecifier() == JS::FreshZone)
zone = NULL;
zone = nullptr;
else
zone = static_cast<Zone *>(options.zonePointer());
JSCompartment *compartment = NewCompartment(cx, zone, principals, options);
if (!compartment)
return NULL;
return nullptr;
// Lazily create the system zone.
if (!rt->systemZone && options.zoneSpecifier() == JS::SystemZone) {
@ -2733,7 +2734,7 @@ JS_NewGlobalObject(JSContext *cx, const JSClass *clasp, JSPrincipals *principals
}
if (!global)
return NULL;
return nullptr;
if (hookOption == JS::FireOnNewGlobalHook)
JS_FireOnNewGlobalObject(cx, global);
@ -3004,7 +3005,7 @@ JS_HasPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, bool *foundp)
RootedObject obj2(cx);
RootedShape prop(cx);
bool ok = LookupPropertyById(cx, obj, id, 0, &obj2, &prop);
*foundp = (prop != NULL);
*foundp = (prop != nullptr);
return ok;
}
@ -3101,7 +3102,7 @@ GetterWrapper(JSPropertyOp getter)
{
JSPropertyOpWrapper ret;
ret.op = getter;
ret.info = NULL;
ret.info = nullptr;
return ret;
}
@ -3110,7 +3111,7 @@ SetterWrapper(JSStrictPropertyOp setter)
{
JSStrictPropertyOpWrapper ret;
ret.op = setter;
ret.info = NULL;
ret.info = nullptr;
return ret;
}
@ -3158,7 +3159,7 @@ DefinePropertyById(JSContext *cx, HandleObject obj, HandleId id, HandleValue val
}
if (setter) {
// Root just the getter, since the setter is not yet a JSObject.
AutoRooterGetterSetter getRoot(cx, JSPROP_GETTER, &getter, NULL);
AutoRooterGetterSetter getRoot(cx, JSPROP_GETTER, &getter, nullptr);
RootedObject global(cx, (JSObject*) &obj->global());
JSFunction *setobj = NewFunction(cx, NullPtr(), (Native) setter, 1,
zeroFlags, global, atom);
@ -3179,10 +3180,10 @@ DefinePropertyById(JSContext *cx, HandleObject obj, HandleId id, HandleValue val
assertSameCompartment(cx, obj, id, value,
(attrs & JSPROP_GETTER)
? JS_FUNC_TO_DATA_PTR(JSObject *, getter)
: NULL,
: nullptr,
(attrs & JSPROP_SETTER)
? JS_FUNC_TO_DATA_PTR(JSObject *, setter)
: NULL);
: nullptr);
JSAutoResolveFlags rf(cx, 0);
if (flags != 0 && obj->isNative()) {
@ -3326,12 +3327,12 @@ JS_DefineObject(JSContext *cx, JSObject *objArg, const char *name, const JSClass
RootedObject nobj(cx, NewObjectWithClassProto(cx, clasp, proto, obj));
if (!nobj)
return NULL;
return nullptr;
if (!DefineProperty(cx, obj, name, ObjectValue(*nobj), GetterWrapper(NULL),
SetterWrapper(NULL), attrs, 0, 0))
if (!DefineProperty(cx, obj, name, ObjectValue(*nobj), GetterWrapper(nullptr),
SetterWrapper(nullptr), attrs, 0, 0))
{
return NULL;
return nullptr;
}
return nobj;
@ -3346,8 +3347,8 @@ JS_DefineConstDoubles(JSContext *cx, JSObject *objArg, const JSConstDoubleSpec *
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
JSPropertyOpWrapper noget = GetterWrapper(NULL);
JSStrictPropertyOpWrapper noset = SetterWrapper(NULL);
JSPropertyOpWrapper noget = GetterWrapper(nullptr);
JSStrictPropertyOpWrapper noset = SetterWrapper(nullptr);
for (ok = true; cds->name; cds++) {
Value value = DoubleValue(cds->dval);
attrs = cds->flags;
@ -3410,8 +3411,8 @@ GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, unsigned
}
if (!JSObject::getGenericAttributes(cx, obj2, id, &desc.attributesRef()))
return false;
JS_ASSERT(desc.getter() == NULL);
JS_ASSERT(desc.setter() == NULL);
JS_ASSERT(desc.getter() == nullptr);
JS_ASSERT(desc.setter() == nullptr);
JS_ASSERT(desc.value().isUndefined());
}
return true;
@ -3690,7 +3691,7 @@ LastConfigurableShape(JSObject *obj)
if (shape->configurable())
return shape;
}
return NULL;
return nullptr;
}
JS_PUBLIC_API(void)
@ -3755,7 +3756,7 @@ JS_Enumerate(JSContext *cx, JSObject *objArg)
AutoIdVector props(cx);
JSIdArray *ida;
if (!GetPropertyNames(cx, obj, JSITER_OWNONLY, &props) || !VectorToIdArray(cx, props, &ida))
return NULL;
return nullptr;
return ida;
}
@ -3816,10 +3817,10 @@ static const Class prop_iter_class = {
JS_ResolveStub,
JS_ConvertStub,
prop_iter_finalize,
NULL, /* checkAccess */
NULL, /* call */
NULL, /* hasInstance */
NULL, /* construct */
nullptr, /* checkAccess */
nullptr, /* call */
nullptr, /* hasInstance */
nullptr, /* construct */
prop_iter_trace
};
@ -3832,9 +3833,9 @@ JS_NewPropertyIterator(JSContext *cx, JSObject *objArg)
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj);
RootedObject iterobj(cx, NewObjectWithClassProto(cx, &prop_iter_class, NULL, obj));
RootedObject iterobj(cx, NewObjectWithClassProto(cx, &prop_iter_class, nullptr, obj));
if (!iterobj)
return NULL;
return nullptr;
int index;
if (obj->isNative()) {
@ -3845,7 +3846,7 @@ JS_NewPropertyIterator(JSContext *cx, JSObject *objArg)
/* Non-native case: enumerate a JSIdArray and keep it via private. */
JSIdArray *ida = JS_Enumerate(cx, obj);
if (!ida)
return NULL;
return nullptr;
iterobj->setPrivate((void *)ida);
index = ida->length;
}
@ -4003,7 +4004,7 @@ JS_SetSecurityCallbacks(JSRuntime *rt, const JSSecurityCallbacks *scb)
JS_PUBLIC_API(const JSSecurityCallbacks *)
JS_GetSecurityCallbacks(JSRuntime *rt)
{
return (rt->securityCallbacks != &NullSecurityCallbacks) ? rt->securityCallbacks : NULL;
return (rt->securityCallbacks != &NullSecurityCallbacks) ? rt->securityCallbacks : nullptr;
}
JS_PUBLIC_API(void)
@ -4035,7 +4036,7 @@ JS_NewFunction(JSContext *cx, JSNative native, unsigned nargs, unsigned flags,
if (name) {
atom = Atomize(cx, name, strlen(name));
if (!atom)
return NULL;
return nullptr;
}
JSFunction::Flags funFlags = JSAPIToJSFunctionFlags(flags);
@ -4093,7 +4094,7 @@ JS_CloneFunctionObject(JSContext *cx, JSObject *funobjArg, JSObject *parentArg)
if (!funobj->is<JSFunction>()) {
AutoCompartment ac(cx, funobj);
ReportIsNotFunction(cx, ObjectValue(*funobj));
return NULL;
return nullptr;
}
/*
@ -4104,23 +4105,23 @@ JS_CloneFunctionObject(JSContext *cx, JSObject *funobjArg, JSObject *parentArg)
if (fun->isInterpretedLazy()) {
AutoCompartment ac(cx, funobj);
if (!fun->getOrCreateScript(cx))
return NULL;
return nullptr;
}
if (fun->isInterpreted() && (fun->nonLazyScript()->enclosingStaticScope() ||
(fun->nonLazyScript()->compileAndGo && !parent->is<GlobalObject>())))
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_CLONE_FUNOBJ_SCOPE);
return NULL;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_CLONE_FUNOBJ_SCOPE);
return nullptr;
}
if (fun->isBoundFunction()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_CLONE_OBJECT);
return NULL;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CLONE_OBJECT);
return nullptr;
}
if (fun->isNative() && IsAsmJSModuleNative(fun->native())) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_CLONE_OBJECT);
return NULL;
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CLONE_OBJECT);
return nullptr;
}
return CloneFunctionObject(cx, fun, parent, fun->getAllocKind());
@ -4182,7 +4183,7 @@ JS_BindCallable(JSContext *cx, JSObject *targetArg, JSObject *newThis)
{
RootedObject target(cx, targetArg);
RootedValue thisArg(cx, ObjectValue(*newThis));
return js_fun_bind(cx, target, thisArg, NULL, 0);
return js_fun_bind(cx, target, thisArg, nullptr, 0);
}
static bool
@ -4268,7 +4269,7 @@ JS_DefineFunctions(JSContext *cx, JSObject *objArg, const JSFunctionSpec *fs)
/*
* Delay cloning self-hosted functions until they are called. This is
* achieved by passing DefineFunction a NULL JSNative which
* achieved by passing DefineFunction a nullptr JSNative which
* produces an interpreted JSFunction where !hasScript. Interpreted
* call paths then call InitializeLazyFunctionScript if !hasScript.
*/
@ -4291,7 +4292,7 @@ JS_DefineFunctions(JSContext *cx, JSObject *objArg, const JSFunctionSpec *fs)
RootedValue funVal(cx);
if (!cx->global()->getSelfHostedFunction(cx, shName, atom, fs->nargs, &funVal))
return false;
if (!JSObject::defineGeneric(cx, obj, id, funVal, NULL, NULL, flags))
if (!JSObject::defineGeneric(cx, obj, id, funVal, nullptr, nullptr, flags))
return false;
} else {
JSFunction *fun = DefineFunction(cx, obj, id, fs->call.op, fs->nargs, flags);
@ -4315,7 +4316,7 @@ JS_DefineFunction(JSContext *cx, JSObject *objArg, const char *name, JSNative ca
assertSameCompartment(cx, obj);
JSAtom *atom = Atomize(cx, name, strlen(name));
if (!atom)
return NULL;
return nullptr;
Rooted<jsid> id(cx, AtomToId(atom));
return DefineFunction(cx, obj, id, call, nargs, attrs);
}
@ -4332,7 +4333,7 @@ JS_DefineUCFunction(JSContext *cx, JSObject *objArg,
assertSameCompartment(cx, obj);
JSAtom *atom = AtomizeChars<CanGC>(cx, name, AUTO_NAMELEN(name, namelen));
if (!atom)
return NULL;
return nullptr;
Rooted<jsid> id(cx, AtomToId(atom));
return DefineFunction(cx, obj, id, call, nargs, attrs);
}
@ -4419,7 +4420,7 @@ class AutoFile
FILE *fp_;
public:
AutoFile()
: fp_(NULL)
: fp_(nullptr)
{}
~AutoFile()
{
@ -4438,7 +4439,7 @@ class AutoFile
} /* anonymous namespace */
/*
* Open a source file for reading. Supports "-" and NULL to mean stdin. The
* Open a source file for reading. Supports "-" and nullptr to mean stdin. The
* return value must be fclosed unless it is stdin.
*/
bool
@ -4449,7 +4450,7 @@ AutoFile::open(JSContext *cx, const char *filename)
} else {
fp_ = fopen(filename, "r");
if (!fp_) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_OPEN,
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_OPEN,
filename, "No such file or directory");
return false;
}
@ -4459,13 +4460,13 @@ AutoFile::open(JSContext *cx, const char *filename)
JS::CompileOptions::CompileOptions(JSContext *cx, JSVersion version)
: principals_(NULL),
originPrincipals_(NULL),
: principals_(nullptr),
originPrincipals_(nullptr),
version(version != JSVERSION_UNKNOWN ? version : cx->findVersion()),
versionSet(false),
utf8(false),
filename(NULL),
sourceMapURL(NULL),
filename(nullptr),
sourceMapURL(nullptr),
lineno(1),
column(0),
element(NullPtr()),
@ -4512,7 +4513,7 @@ JS::Compile(JSContext *cx, HandleObject obj, CompileOptions options,
else
chars = InflateString(cx, bytes, &length);
if (!chars)
return NULL;
return nullptr;
JSScript *script = Compile(cx, obj, options, chars, length);
js_free(chars);
@ -4524,7 +4525,7 @@ JS::Compile(JSContext *cx, HandleObject obj, CompileOptions options, FILE *fp)
{
FileContents buffer(cx);
if (!ReadCompleteFile(cx, fp, buffer))
return NULL;
return nullptr;
JSScript *script = Compile(cx, obj, options, buffer.begin(), buffer.length());
return script;
@ -4535,7 +4536,7 @@ JS::Compile(JSContext *cx, HandleObject obj, CompileOptions options, const char
{
AutoFile file;
if (!file.open(cx, filename))
return NULL;
return nullptr;
options = options.setFileAndLine(filename, 1);
JSScript *script = Compile(cx, obj, options, file.fp());
return script;
@ -4568,7 +4569,7 @@ JS::CanCompileOffThread(JSContext *cx, const CompileOptions &options)
"chrome://browser/content/newtab/newTab.js",
"chrome://browser/content/places/browserPlacesViews.js",
#endif
NULL
nullptr
};
const char *filename = options.filename;
@ -4682,8 +4683,8 @@ JS_BufferIsCompilableUnit(JSContext *cx, JSObject *objArg, const char *utf8, siz
options.setCompileAndGo(false);
Parser<frontend::FullParseHandler> parser(cx, &cx->tempLifoAlloc(),
options, chars, length,
/* foldConstants = */ true, NULL, NULL);
older = JS_SetErrorReporter(cx, NULL);
/* foldConstants = */ true, nullptr, nullptr);
older = JS_SetErrorReporter(cx, nullptr);
if (!parser.parse(obj) && parser.isUnexpectedEOF()) {
/*
* We ran into an error. If it was because we ran out of
@ -4722,29 +4723,29 @@ JS::CompileFunction(JSContext *cx, HandleObject obj, CompileOptions options,
if (name) {
funAtom = Atomize(cx, name, strlen(name));
if (!funAtom)
return NULL;
return nullptr;
}
AutoNameVector formals(cx);
for (unsigned i = 0; i < nargs; i++) {
RootedAtom argAtom(cx, Atomize(cx, argnames[i], strlen(argnames[i])));
if (!argAtom || !formals.append(argAtom->asPropertyName()))
return NULL;
return nullptr;
}
RootedFunction fun(cx, NewFunction(cx, NullPtr(), NULL, 0, JSFunction::INTERPRETED, obj,
RootedFunction fun(cx, NewFunction(cx, NullPtr(), nullptr, 0, JSFunction::INTERPRETED, obj,
funAtom, JSFunction::FinalizeKind, TenuredObject));
if (!fun)
return NULL;
return nullptr;
if (!frontend::CompileFunctionBody(cx, &fun, options, formals, chars, length))
return NULL;
return nullptr;
if (obj && funAtom) {
Rooted<jsid> id(cx, AtomToId(funAtom));
RootedValue value(cx, ObjectValue(*fun));
if (!JSObject::defineGeneric(cx, obj, id, value, NULL, NULL, JSPROP_ENUMERATE))
return NULL;
if (!JSObject::defineGeneric(cx, obj, id, value, nullptr, nullptr, JSPROP_ENUMERATE))
return nullptr;
}
return fun;
@ -4761,7 +4762,7 @@ JS::CompileFunction(JSContext *cx, HandleObject obj, CompileOptions options,
else
chars = InflateString(cx, bytes, &length);
if (!chars)
return NULL;
return nullptr;
JSFunction *fun = CompileFunction(cx, obj, options, name, nargs, argnames, chars, length);
js_free(chars);
@ -4822,7 +4823,7 @@ JS_DecompileScript(JSContext *cx, JSScript *scriptArg, const char *name, unsigne
return JS_DecompileFunction(cx, fun, indent);
bool haveSource = script->scriptSource()->hasSourceData();
if (!haveSource && !JSScript::loadSource(cx, script->scriptSource(), &haveSource))
return NULL;
return nullptr;
return haveSource ? script->sourceData(cx) : js_NewStringCopyZ<CanGC>(cx, "[no source]");
}
@ -4908,7 +4909,7 @@ JS::Evaluate(JSContext *cx, HandleObject obj, CompileOptions options,
SourceCompressionTask sct(cx);
RootedScript script(cx, frontend::CompileScript(cx, &cx->tempLifoAlloc(),
obj, NullPtr(), options,
chars, length, NULL, 0, &sct));
chars, length, nullptr, 0, &sct));
if (!script)
return false;
@ -4924,7 +4925,7 @@ JS::Evaluate(JSContext *cx, HandleObject obj, CompileOptions options,
// to clear out this analysis data before anything happens to inhibit the
// flushing of this memory (such as setting requestAnimationFrame).
if (script->length > LARGE_SCRIPT_LENGTH) {
script = NULL;
script = nullptr;
PrepareZoneForGC(cx->zone());
GC(cx->runtime(), GC_NORMAL, gcreason::FINISH_LARGE_EVALUTE);
}
@ -5154,14 +5155,14 @@ JS_New(JSContext *cx, JSObject *ctorArg, unsigned argc, jsval *argv)
// among other details. InvokeConstructor does the hard work.
InvokeArgs args(cx);
if (!args.init(argc))
return NULL;
return nullptr;
args.setCallee(ObjectValue(*ctor));
args.setThis(NullValue());
PodCopy(args.array(), argv, argc);
if (!InvokeConstructor(cx, args))
return NULL;
return nullptr;
if (!args.rval().isObject()) {
/*
@ -5170,10 +5171,10 @@ JS_New(JSContext *cx, JSObject *ctorArg, unsigned argc, jsval *argv)
*/
JSAutoByteString bytes;
if (js_ValueToPrintable(cx, args.rval(), &bytes)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_NEW_RESULT,
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_NEW_RESULT,
bytes.ptr());
}
return NULL;
return nullptr;
}
return &args.rval().toObject();
@ -5258,7 +5259,7 @@ JS_NewStringCopyZ(JSContext *cx, const char *s)
n = strlen(s);
js = InflateString(cx, s, &n);
if (!js)
return NULL;
return nullptr;
str = js_NewString<CanGC>(cx, js, n);
if (!str)
js_free(js);
@ -5379,7 +5380,7 @@ JS_GetStringCharsZAndLength(JSContext *cx, JSString *str, size_t *plength)
CHECK_REQUEST(cx);
JSFlatString *flat = str->ensureFlat(cx);
if (!flat)
return NULL;
return nullptr;
*plength = flat->length();
return flat->chars();
}
@ -5393,7 +5394,7 @@ JS_GetStringCharsAndLength(JSContext *cx, JSString *str, size_t *plength)
assertSameCompartment(cx, str);
JSLinearString *linear = str->ensureLinear(cx);
if (!linear)
return NULL;
return nullptr;
*plength = linear->length();
return linear->chars();
}
@ -5402,9 +5403,9 @@ JS_PUBLIC_API(const jschar *)
JS_GetInternedStringChars(JSString *str)
{
JS_ASSERT(str->isAtom());
JSFlatString *flat = str->ensureFlat(NULL);
JSFlatString *flat = str->ensureFlat(nullptr);
if (!flat)
return NULL;
return nullptr;
return flat->chars();
}
@ -5413,9 +5414,9 @@ JS_GetInternedStringCharsAndLength(JSString *str, size_t *plength)
{
JS_ASSERT(str->isAtom());
JS_ASSERT(plength);
JSFlatString *flat = str->ensureFlat(NULL);
JSFlatString *flat = str->ensureFlat(nullptr);
if (!flat)
return NULL;
return nullptr;
*plength = flat->length();
return flat->chars();
}
@ -5428,7 +5429,7 @@ JS_FlattenString(JSContext *cx, JSString *str)
assertSameCompartment(cx, str);
JSFlatString *flat = str->ensureFlat(cx);
if (!flat)
return NULL;
return nullptr;
return flat;
}
@ -5485,7 +5486,7 @@ JS_PutEscapedString(JSContext *cx, char *buffer, size_t size, JSString *str, cha
JS_PUBLIC_API(bool)
JS_FileEscapedString(FILE *fp, JSString *str, char quote)
{
JSLinearString *linearStr = str->ensureLinear(NULL);
JSLinearString *linearStr = str->ensureLinear(nullptr);
return linearStr && FileEscapedString(fp, linearStr, quote);
}
@ -5522,7 +5523,7 @@ JS_DecodeBytes(JSContext *cx, const char *src, size_t srclen, jschar *dst, size_
InflateStringToBuffer(src, dstlen, dst);
AutoSuppressGC suppress(cx);
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BUFFER_TOO_SMALL);
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BUFFER_TOO_SMALL);
return false;
}
@ -5539,7 +5540,7 @@ JS_EncodeString(JSContext *cx, JSString *str)
JSLinearString *linear = str->ensureLinear(cx);
if (!linear)
return NULL;
return nullptr;
return LossyTwoByteCharsToNewLatin1CharsZ(cx, linear->range()).c_str();
}
@ -5552,7 +5553,7 @@ JS_EncodeStringToUTF8(JSContext *cx, JSString *str)
JSLinearString *linear = str->ensureLinear(cx);
if (!linear)
return NULL;
return nullptr;
return TwoByteCharsToNewUTF8CharsZ(cx, linear->range()).c_str();
}
@ -5581,10 +5582,10 @@ JS_EncodeStringToBuffer(JSContext *cx, JSString *str, char *buffer, size_t lengt
* error.
*/
size_t writtenLength = length;
const jschar *chars = str->getChars(NULL);
const jschar *chars = str->getChars(nullptr);
if (!chars)
return size_t(-1);
if (DeflateStringToBuffer(NULL, chars, str->length(), buffer, &writtenLength)) {
if (DeflateStringToBuffer(nullptr, chars, str->length(), buffer, &writtenLength)) {
JS_ASSERT(writtenLength <= length);
return writtenLength;
}
@ -5808,11 +5809,11 @@ JS_NewRegExpObject(JSContext *cx, HandleObject obj, char *bytes, size_t length,
CHECK_REQUEST(cx);
jschar *chars = InflateString(cx, bytes, &length);
if (!chars)
return NULL;
return nullptr;
RegExpStatics *res = obj->as<GlobalObject>().getRegExpStatics();
RegExpObject *reobj = RegExpObject::create(cx, res, chars, length,
RegExpFlag(flags), NULL);
RegExpFlag(flags), nullptr);
js_free(chars);
return reobj;
}
@ -5825,7 +5826,7 @@ JS_NewUCRegExpObject(JSContext *cx, HandleObject obj, jschar *chars, size_t leng
CHECK_REQUEST(cx);
RegExpStatics *res = obj->as<GlobalObject>().getRegExpStatics();
return RegExpObject::create(cx, res, chars, length,
RegExpFlag(flags), NULL);
RegExpFlag(flags), nullptr);
}
JS_PUBLIC_API(void)
@ -5868,9 +5869,9 @@ JS_NewRegExpObjectNoStatics(JSContext *cx, char *bytes, size_t length, unsigned
CHECK_REQUEST(cx);
jschar *chars = InflateString(cx, bytes, &length);
if (!chars)
return NULL;
return nullptr;
RegExpObject *reobj = RegExpObject::createNoStatics(cx, chars, length,
RegExpFlag(flags), NULL);
RegExpFlag(flags), nullptr);
js_free(chars);
return reobj;
}
@ -5881,7 +5882,7 @@ JS_NewUCRegExpObjectNoStatics(JSContext *cx, jschar *chars, size_t length, unsig
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
return RegExpObject::createNoStatics(cx, chars, length,
RegExpFlag(flags), NULL);
RegExpFlag(flags), nullptr);
}
JS_PUBLIC_API(bool)
@ -5891,8 +5892,8 @@ JS_ExecuteRegExpNoStatics(JSContext *cx, HandleObject obj, jschar *chars, size_t
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
return ExecuteRegExpLegacy(cx, NULL, obj->as<RegExpObject>(), NullPtr(), chars, length, indexp,
test, rval);
return ExecuteRegExpLegacy(cx, nullptr, obj->as<RegExpObject>(), NullPtr(), chars, length,
indexp, test, rval);
}
JS_PUBLIC_API(bool)
@ -6064,7 +6065,7 @@ JS_ThrowReportedError(JSContext *cx, const char *message,
{
AssertHeapIsIdle(cx);
return JS_IsRunning(cx) &&
js_ErrorToException(cx, message, reportp, NULL, NULL);
js_ErrorToException(cx, message, reportp, nullptr, nullptr);
}
JS_PUBLIC_API(bool)
@ -6207,7 +6208,7 @@ JS_IsIdentifier(JSContext *cx, HandleString str, bool *isIdentifier)
JS_PUBLIC_API(bool)
JS_DescribeScriptedCaller(JSContext *cx, MutableHandleScript script, unsigned *lineno)
{
script.set(NULL);
script.set(nullptr);
if (lineno)
*lineno = 0;
@ -6279,7 +6280,7 @@ JS_EncodeScript(JSContext *cx, HandleScript scriptArg, uint32_t *lengthp)
XDREncoder encoder(cx);
RootedScript script(cx, scriptArg);
if (!encoder.codeScript(&script))
return NULL;
return nullptr;
return encoder.forgetData(lengthp);
}
@ -6289,7 +6290,7 @@ JS_EncodeInterpretedFunction(JSContext *cx, HandleObject funobjArg, uint32_t *le
XDREncoder encoder(cx);
RootedObject funobj(cx, funobjArg);
if (!encoder.codeFunction(&funobj))
return NULL;
return nullptr;
return encoder.forgetData(lengthp);
}
@ -6300,7 +6301,7 @@ JS_DecodeScript(JSContext *cx, const void *data, uint32_t length,
XDRDecoder decoder(cx, data, length, principals, originPrincipals);
RootedScript script(cx);
if (!decoder.codeScript(&script))
return NULL;
return nullptr;
return script;
}
@ -6311,7 +6312,7 @@ JS_DecodeInterpretedFunction(JSContext *cx, const void *data, uint32_t length,
XDRDecoder decoder(cx, data, length, principals, originPrincipals);
RootedObject funobj(cx);
if (!decoder.codeFunction(&funobj))
return NULL;
return nullptr;
return funobj;
}
@ -6340,7 +6341,7 @@ JSAutoByteString::encodeLatin1(ExclusiveContext *cx, JSString *str)
{
JSLinearString *linear = str->ensureLinear(cx);
if (!linear)
return NULL;
return nullptr;
mBytes = LossyTwoByteCharsToNewLatin1CharsZ(cx, linear->range()).c_str();
return mBytes;

Просмотреть файл

@ -150,7 +150,7 @@ class JS_PUBLIC_API(AutoGCRooter) {
class AutoStringRooter : private AutoGCRooter {
public:
AutoStringRooter(JSContext *cx, JSString *str = NULL
AutoStringRooter(JSContext *cx, JSString *str = nullptr
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: AutoGCRooter(cx, STRING), str_(str)
{
@ -802,10 +802,10 @@ typedef bool
* Callback used to ask the embedding for the cross compartment wrapper handler
* that implements the desired prolicy for this kind of object in the
* destination compartment. |obj| is the object to be wrapped. If |existing| is
* non-NULL, it will point to an existing wrapper object that should be re-used
* if possible. |existing| is guaranteed to be a cross-compartment wrapper with
* a lazily-defined prototype and the correct global. It is guaranteed not to
* wrap a function.
* non-nullptr, it will point to an existing wrapper object that should be
* re-used if possible. |existing| is guaranteed to be a cross-compartment
* wrapper with a lazily-defined prototype and the correct global. It is
* guaranteed not to wrap a function.
*/
typedef JSObject *
(* JSWrapObjectCallback)(JSContext *cx, JS::Handle<JSObject*> existing, JS::Handle<JSObject*> obj,
@ -1329,7 +1329,7 @@ JS_DestroyRuntime(JSRuntime *rt);
// These are equivalent to ICU's |UMemAllocFn|, |UMemReallocFn|, and
// |UMemFreeFn| types. The first argument (called |context| in the ICU docs)
// will always be NULL, and should be ignored.
// will always be nullptr, and should be ignored.
typedef void *(*JS_ICUAllocFn)(const void *, size_t size);
typedef void *(*JS_ICUReallocFn)(const void *, void *p, size_t size);
typedef void (*JS_ICUFreeFn)(const void *, void *p);
@ -1589,7 +1589,7 @@ extern JS_PUBLIC_API(bool)
JS_RefreshCrossCompartmentWrappers(JSContext *cx, JSObject *ob);
/*
* At any time, a JSContext has a current (possibly-NULL) compartment.
* At any time, a JSContext has a current (possibly-nullptr) compartment.
* Compartments are described in:
*
* developer.mozilla.org/en-US/docs/SpiderMonkey/SpiderMonkey_compartments
@ -1633,7 +1633,7 @@ class JS_PUBLIC_API(JSAutoCompartment)
~JSAutoCompartment();
};
/* NB: This API is infallible; a NULL return value does not indicate error. */
/* NB: This API is infallible; a nullptr return value does not indicate error. */
extern JS_PUBLIC_API(JSCompartment *)
JS_EnterCompartment(JSContext *cx, JSObject *target);
@ -1718,8 +1718,8 @@ extern JS_PUBLIC_API(bool)
JS_IsGlobalObject(JSObject *obj);
/*
* May return NULL, if |c| never had a global (e.g. the atoms compartment), or
* if |c|'s global has been collected.
* May return nullptr, if |c| never had a global (e.g. the atoms compartment),
* or if |c|'s global has been collected.
*/
extern JS_PUBLIC_API(JSObject *)
JS_GetGlobalForCompartmentOrNull(JSContext *cx, JSCompartment *c);
@ -1767,7 +1767,7 @@ typedef char *
/*
* Set of function pointers that ctypes can use for various internal functions.
* See JS_SetCTypesCallbacks below. Providing NULL for a function is safe,
* See JS_SetCTypesCallbacks below. Providing nullptr for a function is safe,
* and will result in the applicable ctypes functionality not being available.
*/
struct JSCTypesCallbacks {
@ -1805,7 +1805,7 @@ JS_realloc(JSContext *cx, void *p, size_t nbytes);
/*
* A wrapper for js_free(p) that may delay js_free(p) invocation as a
* performance optimization.
* cx may be NULL.
* cx may be nullptr.
*/
extern JS_PUBLIC_API(void)
JS_free(JSContext *cx, void *p);
@ -2153,8 +2153,8 @@ extern JS_PUBLIC_API(bool)
JS_IsExternalString(JSString *str);
/*
* Return the 'closure' arg passed to JS_NewExternalStringWithClosure or NULL
* if the external string was created via JS_NewExternalString.
* Return the 'closure' arg passed to JS_NewExternalStringWithClosure or
* nullptr if the external string was created via JS_NewExternalString.
*/
extern JS_PUBLIC_API(const JSStringFinalizer *)
JS_GetExternalStringFinalizer(JSString *str);
@ -2221,7 +2221,7 @@ class AutoIdArray : private AutoGCRooter
JSIdArray *steal() {
JSIdArray *copy = idArray;
idArray = NULL;
idArray = nullptr;
return copy;
}
@ -2318,8 +2318,8 @@ typedef struct JSNativeWrapper {
* Macro static initializers which make it easy to pass no JSJitInfo as part of a
* JSPropertySpec or JSFunctionSpec.
*/
#define JSOP_WRAPPER(op) {op, NULL}
#define JSOP_NULLWRAPPER JSOP_WRAPPER(NULL)
#define JSOP_WRAPPER(op) {op, nullptr}
#define JSOP_NULLWRAPPER JSOP_WRAPPER(nullptr)
/*
* To define an array element rather than a named property member, cast the
@ -2387,7 +2387,7 @@ struct JSFunctionSpec {
* Terminating sentinel initializer to put at the end of a JSFunctionSpec array
* that's passed to JS_DefineFunctions or JS_InitClass.
*/
#define JS_FS_END JS_FS(NULL,NULL,0,0)
#define JS_FS_END JS_FS(nullptr,nullptr,0,0)
/*
* Initializer macros for a JSFunctionSpec array element. JS_FN (whose name pays
@ -2655,8 +2655,8 @@ struct JSPropertyDescriptor {
JSStrictPropertyOp setter;
JS::Value value;
JSPropertyDescriptor() : obj(NULL), attrs(0), shortid(0), getter(NULL),
setter(NULL), value(JSVAL_VOID)
JSPropertyDescriptor() : obj(nullptr), attrs(0), shortid(0), getter(nullptr),
setter(nullptr), value(JSVAL_VOID)
{}
void trace(JSTracer *trc);
@ -2712,11 +2712,11 @@ class MutablePropertyDescriptorOperations : public PropertyDescriptorOperations<
public:
void clear() {
object().set(NULL);
object().set(nullptr);
setAttributes(0);
setShortId(0);
setGetter(NULL);
setSetter(NULL);
setGetter(nullptr);
setSetter(nullptr);
value().setUndefined();
}
@ -2985,9 +2985,9 @@ extern JS_PUBLIC_API(bool)
JS_AllocateArrayBufferContents(JSContext *cx, uint32_t nbytes, void **contents, uint8_t **data);
/*
* Reallocate memory allocated by JS_AllocateArrayBufferContents, growing or shrinking it
* as appropriate. The new data pointer will be returned in data. If *contents is NULL,
* behaves like JS_AllocateArrayBufferContents.
* Reallocate memory allocated by JS_AllocateArrayBufferContents, growing or
* shrinking it as appropriate. The new data pointer will be returned in data.
* If *contents is nullptr, behaves like JS_AllocateArrayBufferContents.
*/
extern JS_PUBLIC_API(bool)
JS_ReallocateArrayBufferContents(JSContext *cx, uint32_t nbytes, void **contents, uint8_t **data);
@ -3084,7 +3084,7 @@ JS_GetSecurityCallbacks(JSRuntime *rt);
* there is no available JSContext. Instead, the caller must ensure that the
* given principals stays valid for as long as 'rt' may point to it. If the
* principals would be destroyed before 'rt', JS_SetTrustedPrincipals must be
* called again, passing NULL for 'prin'.
* called again, passing nullptr for 'prin'.
*/
extern JS_PUBLIC_API(void)
JS_SetTrustedPrincipals(JSRuntime *rt, const JSPrincipals *prin);
@ -3137,8 +3137,8 @@ JS_GetFunctionId(JSFunction *fun);
* Return a function's display name. This is the defined name if one was given
* where the function was defined, or it could be an inferred name by the JS
* engine in the case that the function was defined to be anonymous. This can
* still return NULL if a useful display name could not be inferred. The same
* restrictions on rooting as those in JS_GetFunctionId apply.
* still return nullptr if a useful display name could not be inferred. The
* same restrictions on rooting as those in JS_GetFunctionId apply.
*/
extern JS_PUBLIC_API(JSString *)
JS_GetFunctionDisplayId(JSFunction *fun);
@ -3171,7 +3171,7 @@ JS_IsConstructor(JSFunction *fun);
/*
* Bind the given callable to use the given object as "this".
*
* If |callable| is not callable, will throw and return NULL.
* If |callable| is not callable, will throw and return nullptr.
*/
extern JS_PUBLIC_API(JSObject*)
JS_BindCallable(JSContext *cx, JSObject *callable, JSObject *newThis);
@ -3332,8 +3332,8 @@ CanCompileOffThread(JSContext *cx, const CompileOptions &options);
* for the compilation. The callback will be invoked while off the main thread,
* so must ensure that its operations are thread safe. Afterwards,
* FinishOffThreadScript must be invoked on the main thread to get the result
* script or NULL. If maybecx is specified, this method will also report any
* error or warnings generated during the parse.
* script or nullptr. If maybecx is specified, this method will also report
* any error or warnings generated during the parse.
*
* The characters passed in to CompileOffThread must remain live until the
* callback is invoked, and the resulting script will be rooted until the call
@ -3763,10 +3763,10 @@ JS_ConcatStrings(JSContext *cx, JS::HandleString left, JS::HandleString right);
* For JS_DecodeBytes, set *dstlenp to the size of the destination buffer before
* the call; on return, *dstlenp contains the number of jschars actually stored.
* To determine the necessary destination buffer size, make a sizing call that
* passes NULL for dst.
* passes nullptr for dst.
*
* On errors, the functions report the error. In that case, *dstlenp contains
* the number of characters or bytes transferred so far. If cx is NULL, no
* the number of characters or bytes transferred so far. If cx is nullptr, no
* error is reported on failure, and the functions simply return false.
*
* NB: This function does not store an additional zero byte or jschar after the
@ -3820,7 +3820,7 @@ class JSAutoByteString
}
JSAutoByteString(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: mBytes(NULL)
: mBytes(nullptr)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
@ -3853,7 +3853,7 @@ class JSAutoByteString
void clear() {
js_free(mBytes);
mBytes = NULL;
mBytes = nullptr;
}
char *ptr() const {
@ -3933,14 +3933,14 @@ struct JSLocaleCallbacks {
/*
* Establish locale callbacks. The pointer must persist as long as the
* JSRuntime. Passing NULL restores the default behaviour.
* JSRuntime. Passing nullptr restores the default behaviour.
*/
extern JS_PUBLIC_API(void)
JS_SetLocaleCallbacks(JSRuntime *rt, JSLocaleCallbacks *callbacks);
/*
* Return the address of the current locale callbacks struct, which may
* be NULL.
* be nullptr.
*/
extern JS_PUBLIC_API(JSLocaleCallbacks *)
JS_GetLocaleCallbacks(JSRuntime *rt);
@ -4182,9 +4182,9 @@ JS_DropExceptionState(JSContext *cx, JSExceptionState *state);
/*
* If the given value is an exception object that originated from an error,
* the exception will contain an error report struct, and this API will return
* the address of that struct. Otherwise, it returns NULL. The lifetime of
* the error report struct that might be returned is the same as the lifetime
* of the exception object.
* the address of that struct. Otherwise, it returns nullptr. The lifetime
* of the error report struct that might be returned is the same as the
* lifetime of the exception object.
*/
extern JS_PUBLIC_API(JSErrorReport *)
JS_ErrorFromException(JSContext *cx, JS::HandleValue v);

Просмотреть файл

@ -37,7 +37,7 @@ ProxyObject::New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, Tag
if (proto.isObject() && !options.singleton()) {
RootedObject protoObj(cx, proto.toObject());
if (!JSObject::setNewTypeUnknown(cx, clasp, protoObj))
return NULL;
return nullptr;
}
NewObjectKind newKind =
@ -47,7 +47,7 @@ ProxyObject::New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, Tag
allocKind = GetBackgroundAllocKind(allocKind);
RootedObject obj(cx, NewObjectWithGivenProto(cx, clasp, proto, parent, allocKind, newKind));
if (!obj)
return NULL;
return nullptr;
Rooted<ProxyObject*> proxy(cx, &obj->as<ProxyObject>());
proxy->initHandler(handler);