Bug 784739 - Switch from NULL to nullptr in js/jsd/; r=ehsan
This commit is contained in:
10
js/jsd/jsd.h
10
js/jsd/jsd.h
@@ -746,11 +746,11 @@ extern JSDStaticLock* _jsd_global_lock;
|
||||
|
||||
/* locks for the subsystems of a given context */
|
||||
#define JSD_INIT_LOCKS(jsdc) \
|
||||
( (NULL != (jsdc->scriptsLock = jsd_CreateLock())) && \
|
||||
(NULL != (jsdc->sourceTextLock = jsd_CreateLock())) && \
|
||||
(NULL != (jsdc->atomsLock = jsd_CreateLock())) && \
|
||||
(NULL != (jsdc->objectsLock = jsd_CreateLock())) && \
|
||||
(NULL != (jsdc->threadStatesLock = jsd_CreateLock())) )
|
||||
( (nullptr != (jsdc->scriptsLock = jsd_CreateLock())) && \
|
||||
(nullptr != (jsdc->sourceTextLock = jsd_CreateLock())) && \
|
||||
(nullptr != (jsdc->atomsLock = jsd_CreateLock())) && \
|
||||
(nullptr != (jsdc->objectsLock = jsd_CreateLock())) && \
|
||||
(nullptr != (jsdc->threadStatesLock = jsd_CreateLock())) )
|
||||
|
||||
#define JSD_LOCK_SCRIPTS(jsdc) jsd_Lock(jsdc->scriptsLock)
|
||||
#define JSD_UNLOCK_SCRIPTS(jsdc) jsd_Unlock(jsdc->scriptsLock)
|
||||
|
||||
@@ -45,8 +45,8 @@ _atom_smasher(JSHashEntry *he, int i, void *arg)
|
||||
|
||||
free(((JSDAtom*)(he->value))->str);
|
||||
free(he->value);
|
||||
he->value = NULL;
|
||||
he->key = NULL;
|
||||
he->value = nullptr;
|
||||
he->key = nullptr;
|
||||
return HT_ENUMERATE_NEXT;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ jsd_CreateAtomTable(JSDContext* jsdc)
|
||||
{
|
||||
jsdc->atoms = JS_NewHashTable(256, JS_HashString,
|
||||
_compareAtomKeys, _compareAtoms,
|
||||
NULL, NULL);
|
||||
nullptr, nullptr);
|
||||
#ifdef TEST_ATOMS
|
||||
_testAtoms(jsdc);
|
||||
#endif
|
||||
@@ -80,9 +80,9 @@ jsd_DestroyAtomTable(JSDContext* jsdc)
|
||||
{
|
||||
if( jsdc->atoms )
|
||||
{
|
||||
JS_HashTableEnumerateEntries(jsdc->atoms, _atom_smasher, NULL);
|
||||
JS_HashTableEnumerateEntries(jsdc->atoms, _atom_smasher, nullptr);
|
||||
JS_HashTableDestroy(jsdc->atoms);
|
||||
jsdc->atoms = NULL;
|
||||
jsdc->atoms = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ jsd_AddAtom(JSDContext* jsdc, const char* str)
|
||||
if(!str)
|
||||
{
|
||||
JS_ASSERT(0);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSD_LOCK_ATOMS(jsdc);
|
||||
@@ -114,7 +114,7 @@ jsd_AddAtom(JSDContext* jsdc, const char* str)
|
||||
{
|
||||
free(atom->str);
|
||||
free(atom);
|
||||
atom = NULL;
|
||||
atom = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,15 +20,15 @@ JSCList _jsd_context_list = JS_INIT_STATIC_CLIST(&_jsd_context_list);
|
||||
|
||||
/* these are used to connect JSD_SetUserCallbacks() with JSD_DebuggerOn() */
|
||||
static JSD_UserCallbacks _callbacks;
|
||||
static void* _user = NULL;
|
||||
static JSRuntime* _jsrt = NULL;
|
||||
static void* _user = nullptr;
|
||||
static JSRuntime* _jsrt = nullptr;
|
||||
|
||||
#ifdef JSD_HAS_DANGEROUS_THREAD
|
||||
static void* _dangerousThread = NULL;
|
||||
static void* _dangerousThread = nullptr;
|
||||
#endif
|
||||
|
||||
#ifdef JSD_THREADSAFE
|
||||
JSDStaticLock* _jsd_global_lock = NULL;
|
||||
JSDStaticLock* _jsd_global_lock = nullptr;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -72,15 +72,15 @@ _newJSDContext(JSRuntime* jsrt,
|
||||
void* user,
|
||||
JSObject* scopeobj)
|
||||
{
|
||||
JSDContext* jsdc = NULL;
|
||||
JSDContext* jsdc = nullptr;
|
||||
bool ok = true;
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
if( ! jsrt )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if( ! _validateUserCallbacks(callbacks) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdc = (JSDContext*) calloc(1, sizeof(JSDContext));
|
||||
if( ! jsdc )
|
||||
@@ -131,7 +131,7 @@ _newJSDContext(JSRuntime* jsrt,
|
||||
if( ! ok )
|
||||
goto label_newJSDContext_failure;
|
||||
|
||||
jsdc->data = NULL;
|
||||
jsdc->data = nullptr;
|
||||
jsdc->inited = true;
|
||||
|
||||
JSD_LOCK();
|
||||
@@ -148,7 +148,7 @@ label_newJSDContext_failure:
|
||||
jsd_DestroyAtomTable(jsdc);
|
||||
free(jsdc);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -188,7 +188,7 @@ jsd_DebuggerOnForUser(JSRuntime* jsrt,
|
||||
|
||||
jsdc = _newJSDContext(jsrt, callbacks, user, scopeobj);
|
||||
if( ! jsdc )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
/*
|
||||
* Set hooks here. The new/destroy script hooks are on even when
|
||||
@@ -211,7 +211,7 @@ jsd_DebuggerOn(void)
|
||||
{
|
||||
JS_ASSERT(_jsrt);
|
||||
JS_ASSERT(_validateUserCallbacks(&_callbacks));
|
||||
return jsd_DebuggerOnForUser(_jsrt, &_callbacks, _user, NULL);
|
||||
return jsd_DebuggerOnForUser(_jsrt, &_callbacks, _user, nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -219,8 +219,8 @@ jsd_DebuggerOff(JSDContext* jsdc)
|
||||
{
|
||||
jsd_DebuggerPause(jsdc, true);
|
||||
/* clear hooks here */
|
||||
JS_SetNewScriptHookProc(jsdc->jsrt, NULL, NULL);
|
||||
JS_SetDestroyScriptHookProc(jsdc->jsrt, NULL, NULL);
|
||||
JS_SetNewScriptHookProc(jsdc->jsrt, nullptr, nullptr);
|
||||
JS_SetDestroyScriptHookProc(jsdc->jsrt, nullptr, nullptr);
|
||||
|
||||
/* clean up */
|
||||
JSD_LockScriptSubsystem(jsdc);
|
||||
@@ -231,19 +231,19 @@ jsd_DebuggerOff(JSDContext* jsdc)
|
||||
_destroyJSDContext(jsdc);
|
||||
|
||||
if( jsdc->userCallbacks.setContext )
|
||||
jsdc->userCallbacks.setContext(NULL, jsdc->user);
|
||||
jsdc->userCallbacks.setContext(nullptr, jsdc->user);
|
||||
}
|
||||
|
||||
void
|
||||
jsd_DebuggerPause(JSDContext* jsdc, bool forceAllHooksOff)
|
||||
{
|
||||
JS_SetDebuggerHandler(jsdc->jsrt, NULL, NULL);
|
||||
JS_SetDebuggerHandler(jsdc->jsrt, nullptr, nullptr);
|
||||
if (forceAllHooksOff || !(jsdc->flags & JSD_COLLECT_PROFILE_DATA)) {
|
||||
JS_SetExecuteHook(jsdc->jsrt, NULL, NULL);
|
||||
JS_SetCallHook(jsdc->jsrt, NULL, NULL);
|
||||
JS_SetExecuteHook(jsdc->jsrt, nullptr, nullptr);
|
||||
JS_SetCallHook(jsdc->jsrt, nullptr, nullptr);
|
||||
}
|
||||
JS_SetThrowHook(jsdc->jsrt, NULL, NULL);
|
||||
JS_SetDebugErrorHook(jsdc->jsrt, NULL, NULL);
|
||||
JS_SetThrowHook(jsdc->jsrt, nullptr, nullptr);
|
||||
JS_SetDebugErrorHook(jsdc->jsrt, nullptr, nullptr);
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -309,7 +309,7 @@ JSDContext*
|
||||
jsd_JSDContextForJSContext(JSContext* context)
|
||||
{
|
||||
JSDContext* iter;
|
||||
JSDContext* jsdc = NULL;
|
||||
JSDContext* jsdc = nullptr;
|
||||
JSRuntime* runtime = JS_GetRuntime(context);
|
||||
|
||||
JSD_LOCK();
|
||||
|
||||
@@ -129,7 +129,7 @@ jsd_CallExecutionHook(JSDContext* jsdc,
|
||||
JSD_HOOK_RETURN_CONTINUE;
|
||||
JSDThreadState* jsdthreadstate;
|
||||
|
||||
if(hook && NULL != (jsdthreadstate = jsd_NewThreadState(jsdc,cx)))
|
||||
if(hook && nullptr != (jsdthreadstate = jsd_NewThreadState(jsdc, cx)))
|
||||
{
|
||||
if ((type != JSD_HOOK_THROW && type != JSD_HOOK_INTERRUPTED) ||
|
||||
jsdc->flags & JSD_MASK_TOP_FRAME_ONLY ||
|
||||
@@ -179,7 +179,7 @@ jsd_CallCallHook (JSDContext* jsdc,
|
||||
JSDThreadState* jsdthreadstate;
|
||||
|
||||
hookanswer = false;
|
||||
if(hook && NULL != (jsdthreadstate = jsd_NewThreadState(jsdc, cx)))
|
||||
if(hook && nullptr != (jsdthreadstate = jsd_NewThreadState(jsdc, cx)))
|
||||
{
|
||||
hookanswer = hook(jsdc, jsdthreadstate, type, hookData);
|
||||
jsd_DestroyThreadState(jsdc, jsdthreadstate);
|
||||
@@ -206,8 +206,8 @@ bool
|
||||
jsd_ClearInterruptHook(JSDContext* jsdc)
|
||||
{
|
||||
JSD_LOCK();
|
||||
JS_ClearInterrupt(jsdc->jsrt, NULL, NULL );
|
||||
jsdc->interruptHook = NULL;
|
||||
JS_ClearInterrupt(jsdc->jsrt, nullptr, nullptr);
|
||||
jsdc->interruptHook = nullptr;
|
||||
JSD_UNLOCK();
|
||||
|
||||
return true;
|
||||
@@ -230,7 +230,7 @@ bool
|
||||
jsd_ClearDebugBreakHook(JSDContext* jsdc)
|
||||
{
|
||||
JSD_LOCK();
|
||||
jsdc->debugBreakHook = NULL;
|
||||
jsdc->debugBreakHook = nullptr;
|
||||
JSD_UNLOCK();
|
||||
|
||||
return true;
|
||||
@@ -253,7 +253,7 @@ bool
|
||||
jsd_ClearDebuggerHook(JSDContext* jsdc)
|
||||
{
|
||||
JSD_LOCK();
|
||||
jsdc->debuggerHook = NULL;
|
||||
jsdc->debuggerHook = nullptr;
|
||||
JSD_UNLOCK();
|
||||
|
||||
return true;
|
||||
@@ -276,7 +276,7 @@ bool
|
||||
jsd_ClearThrowHook(JSDContext* jsdc)
|
||||
{
|
||||
JSD_LOCK();
|
||||
jsdc->throwHook = NULL;
|
||||
jsdc->throwHook = nullptr;
|
||||
JSD_UNLOCK();
|
||||
|
||||
return true;
|
||||
@@ -299,7 +299,7 @@ bool
|
||||
jsd_ClearFunctionHook(JSDContext* jsdc)
|
||||
{
|
||||
JSD_LOCK();
|
||||
jsdc->functionHook = NULL;
|
||||
jsdc->functionHook = nullptr;
|
||||
JSD_UNLOCK();
|
||||
|
||||
return true;
|
||||
@@ -322,7 +322,7 @@ bool
|
||||
jsd_ClearTopLevelHook(JSDContext* jsdc)
|
||||
{
|
||||
JSD_LOCK();
|
||||
jsdc->toplevelHook = NULL;
|
||||
jsdc->toplevelHook = nullptr;
|
||||
JSD_UNLOCK();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -73,7 +73,7 @@ _constructJSStackFrameInfo( ExecEnv* ee, JSDStackFrameInfo* jsdframe,
|
||||
"(Lnetscape/jsdebug/JSThreadState;)",
|
||||
threadState );
|
||||
if( ! frame )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
/* XXX fill in additional fields */
|
||||
unhand(frame)->_nativePtr = (long) jsdframe;
|
||||
@@ -91,7 +91,7 @@ _constructJSPC( ExecEnv* ee, struct Hnetscape_jsdebug_Script* script, long pc )
|
||||
"(Lnetscape/jsdebug/Script;I)",
|
||||
script, pc );
|
||||
if( ! pcOb )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
/* XXX fill in additional fields */
|
||||
|
||||
@@ -317,10 +317,10 @@ _errorReporter( JSDContext* jsdc,
|
||||
void* callerdata )
|
||||
{
|
||||
JHandle* reporter;
|
||||
JHandle* msg = NULL;
|
||||
JHandle* filename = NULL;
|
||||
JHandle* msg = nullptr;
|
||||
JHandle* filename = nullptr;
|
||||
int lineno = 0;
|
||||
JHandle* linebuf = NULL;
|
||||
JHandle* linebuf = nullptr;
|
||||
int tokenOffset = 0;
|
||||
ExecEnv* ee = EE();
|
||||
|
||||
@@ -380,9 +380,9 @@ void netscape_jsdebug_DebugController__setController(struct Hnetscape_jsdebug_De
|
||||
{
|
||||
/* XXX stop somehow... */
|
||||
/* kill context */
|
||||
JSD_SetDebugBreakHook(context, NULL, NULL );
|
||||
JSD_SetErrorReporter(context, NULL, NULL);
|
||||
JSD_SetScriptHook(context, NULL, NULL);
|
||||
JSD_SetDebugBreakHook(context, nullptr, nullptr);
|
||||
JSD_SetErrorReporter(context, nullptr, nullptr);
|
||||
JSD_SetScriptHook(context, nullptr, nullptr);
|
||||
context = 0;
|
||||
controller = 0;
|
||||
}
|
||||
@@ -439,16 +439,16 @@ struct Hjava_lang_String *netscape_jsdebug_DebugController_executeScriptInStackF
|
||||
jsdframe = (JSDStackFrameInfo*) unhand(frame)->_nativePtr;
|
||||
|
||||
if( ! context || ! controller || ! jsdframe )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
filenameC = allocCString(filename);
|
||||
if( ! filenameC )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
srcC = allocCString(src);
|
||||
if( ! srcC )
|
||||
{
|
||||
free(filenameC);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
srclen = strlen(srcC);
|
||||
@@ -464,14 +464,14 @@ struct Hjava_lang_String *netscape_jsdebug_DebugController_executeScriptInStackF
|
||||
|
||||
|
||||
if( ! success )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if( JSVAL_IS_NULL(rval) || JSVAL_IS_VOID(rval) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsstr = JSD_ValToStringInStackFrame(context,jsdthreadstate,jsdframe,rval);
|
||||
if( ! jsstr )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
/* XXXbe should use JS_GetStringChars and preserve Unicode. */
|
||||
return makeJavaString((char*)JS_GetStringBytes(jsstr), JS_GetStringLength(jsstr));
|
||||
@@ -533,16 +533,16 @@ struct Hnetscape_jsdebug_StackFrameInfo *netscape_jsdebug_JSThreadState_getCurre
|
||||
JSDStackFrameInfo* jsdframe;
|
||||
|
||||
if( ! context || ! controller )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdstate = (JSDThreadState*) unhand(self)->nativeThreadState;
|
||||
|
||||
if( ! jsdstate )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdframe = JSD_GetStackFrame(context, jsdstate);
|
||||
if( ! jsdframe )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return (struct Hnetscape_jsdebug_StackFrameInfo*)
|
||||
_constructJSStackFrameInfo( 0, jsdframe, self );
|
||||
@@ -560,23 +560,23 @@ struct Hnetscape_jsdebug_StackFrameInfo *netscape_jsdebug_JSStackFrameInfo_getCa
|
||||
JSDThreadState* jsdthreadstate;
|
||||
|
||||
if( ! context || ! controller )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdframeCur = (JSDStackFrameInfo*) unhand(self)->_nativePtr;
|
||||
if( ! jsdframeCur )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
threadState = (struct Hnetscape_jsdebug_JSThreadState*) unhand(self)->threadState;
|
||||
if( ! threadState )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdthreadstate = (JSDThreadState*) unhand(threadState)->nativeThreadState;
|
||||
if( ! jsdthreadstate )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdframeCaller = JSD_GetCallingStackFrame(context, jsdthreadstate, jsdframeCur);
|
||||
if( ! jsdframeCaller )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return (struct Hnetscape_jsdebug_StackFrameInfo*)
|
||||
_constructJSStackFrameInfo( 0, jsdframeCaller, threadState );
|
||||
@@ -592,31 +592,31 @@ struct Hnetscape_jsdebug_PC *netscape_jsdebug_JSStackFrameInfo_getPC(struct Hnet
|
||||
ExecEnv* ee = EE();
|
||||
|
||||
if( ! context || ! controller || ! ee )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdframe = (JSDStackFrameInfo*) unhand(self)->_nativePtr;
|
||||
if( ! jsdframe )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
threadState = (struct Hnetscape_jsdebug_JSThreadState*) unhand(self)->threadState;
|
||||
if( ! threadState )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdthreadstate = (JSDThreadState*) unhand(threadState)->nativeThreadState;
|
||||
if( ! jsdthreadstate )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdscript = JSD_GetScriptForStackFrame(context, jsdthreadstate, jsdframe );
|
||||
if( ! jsdscript )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
script = _scriptObFromJSDScriptPtr(ee, jsdscript);
|
||||
if( ! script )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
pc = JSD_GetPCForStackFrame(context, jsdthreadstate, jsdframe);
|
||||
if( ! pc )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return (struct Hnetscape_jsdebug_PC*) _constructJSPC(ee, script, pc);
|
||||
}
|
||||
@@ -635,16 +635,16 @@ struct Hnetscape_jsdebug_SourceLocation *netscape_jsdebug_JSPC_getSourceLocation
|
||||
ExecEnv* ee = EE();
|
||||
|
||||
if( ! context || ! controller || ! ee )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
script = unhand(self)->script;
|
||||
|
||||
if( ! script )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdscript = (JSDScript*) unhand(script)->_nativePtr;
|
||||
if( ! jsdscript )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
pc = unhand(self)->pc;
|
||||
|
||||
line = JSD_GetClosestLine(context, jsdscript, pc);
|
||||
@@ -652,7 +652,7 @@ struct Hnetscape_jsdebug_SourceLocation *netscape_jsdebug_JSPC_getSourceLocation
|
||||
|
||||
newPCOb = _constructJSPC(ee, script, newpc );
|
||||
if( ! newPCOb )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return (struct Hnetscape_jsdebug_SourceLocation *)
|
||||
execute_java_constructor( ee, "netscape/jsdebug/JSSourceLocation", 0,
|
||||
@@ -666,7 +666,7 @@ struct Hnetscape_jsdebug_SourceLocation *netscape_jsdebug_JSPC_getSourceLocation
|
||||
struct Hnetscape_jsdebug_SourceTextItem *netscape_jsdebug_JSSourceTextProvider_loadSourceTextItem0(struct Hnetscape_jsdebug_JSSourceTextProvider * self,struct Hjava_lang_String * url)
|
||||
{
|
||||
/* this should attempt to load the source for the indicated URL */
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void netscape_jsdebug_JSSourceTextProvider_refreshSourceTextVector(struct Hnetscape_jsdebug_JSSourceTextProvider * self)
|
||||
|
||||
@@ -56,7 +56,8 @@ struct JSDStaticLock
|
||||
JS_BEGIN_MACRO \
|
||||
out = (void*) PR_GetCurrentThread(); \
|
||||
if(!out) \
|
||||
out = (void*) JS_AttachThread(PR_USER_THREAD,PR_PRIORITY_NORMAL,NULL);\
|
||||
out = (void*) JS_AttachThread(PR_USER_THREAD, PR_PRIORITY_NORMAL, \
|
||||
nullptr); \
|
||||
JS_ASSERT(out); \
|
||||
JS_END_MACRO
|
||||
#else
|
||||
@@ -91,7 +92,7 @@ jsd_CreateLock()
|
||||
if(lock)
|
||||
{
|
||||
free(lock);
|
||||
lock = NULL;
|
||||
lock = nullptr;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
@@ -136,7 +137,7 @@ jsd_Unlock(JSDStaticLock* lock)
|
||||
|
||||
if(--lock->count == 0)
|
||||
{
|
||||
lock->owner = NULL;
|
||||
lock->owner = nullptr;
|
||||
PR_Unlock(lock->lock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ jsd_InitObjectManager(JSDContext* jsdc)
|
||||
JS_INIT_CLIST(&jsdc->objectsList);
|
||||
jsdc->objectsTable = JS_NewHashTable(256, _hash_root,
|
||||
JS_CompareValues, JS_CompareValues,
|
||||
NULL, NULL);
|
||||
nullptr, nullptr);
|
||||
return !!jsdc->objectsTable;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ jsd_IterateObjects(JSDContext* jsdc, JSDObject** iterp)
|
||||
if( !jsdobj )
|
||||
jsdobj = (JSDObject *)jsdc->objectsList.next;
|
||||
if( jsdobj == (JSDObject *)&jsdc->objectsList )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
*iterp = (JSDObject*) jsdobj->links.next;
|
||||
return jsdobj;
|
||||
}
|
||||
@@ -177,7 +177,7 @@ jsd_GetObjectNewURL(JSDContext* jsdc, JSDObject* jsdobj)
|
||||
{
|
||||
if( jsdobj->newURL )
|
||||
return JSD_ATOM_TO_STRING(jsdobj->newURL);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
unsigned
|
||||
@@ -191,7 +191,7 @@ jsd_GetObjectConstructorURL(JSDContext* jsdc, JSDObject* jsdobj)
|
||||
{
|
||||
if( jsdobj->ctorURL )
|
||||
return JSD_ATOM_TO_STRING(jsdobj->ctorURL);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
unsigned
|
||||
@@ -205,7 +205,7 @@ jsd_GetObjectConstructorName(JSDContext* jsdc, JSDObject* jsdobj)
|
||||
{
|
||||
if( jsdobj->ctorName )
|
||||
return JSD_ATOM_TO_STRING(jsdobj->ctorName);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSDObject*
|
||||
|
||||
@@ -45,7 +45,7 @@ _newJSDScript(JSDContext* jsdc,
|
||||
{
|
||||
JS::RootedScript script(cx, script_);
|
||||
if ( JS_GetScriptIsSelfHosted(script) )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JSDScript* jsdscript;
|
||||
unsigned lineno;
|
||||
@@ -56,11 +56,11 @@ _newJSDScript(JSDContext* jsdc,
|
||||
/* these are inlined javascript: urls and we can't handle them now */
|
||||
lineno = (unsigned) JS_GetScriptBaseLineNumber(cx, script);
|
||||
if( lineno == 0 )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdscript = (JSDScript*) calloc(1, sizeof(JSDScript));
|
||||
if( ! jsdscript )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
raw_filename = JS_GetScriptFilename(cx,script);
|
||||
|
||||
@@ -70,7 +70,7 @@ _newJSDScript(JSDContext* jsdc,
|
||||
jsdscript->script = script;
|
||||
jsdscript->lineBase = lineno;
|
||||
jsdscript->lineExtent = (unsigned)NOT_SET_YET;
|
||||
jsdscript->data = NULL;
|
||||
jsdscript->data = nullptr;
|
||||
jsdscript->url = (char*) jsd_BuildNormalizedURL(raw_filename);
|
||||
|
||||
JS_INIT_CLIST(&jsdscript->hooks);
|
||||
@@ -142,11 +142,11 @@ _dumpJSDScript(JSDContext* jsdc, JSDScript* jsdscript, const char* leadingtext)
|
||||
static void
|
||||
_dumpJSDScriptList( JSDContext* jsdc )
|
||||
{
|
||||
JSDScript* iterp = NULL;
|
||||
JSDScript* jsdscript = NULL;
|
||||
JSDScript* iterp = nullptr;
|
||||
JSDScript* jsdscript = nullptr;
|
||||
|
||||
OutputDebugString( "*** JSDScriptDump\n" );
|
||||
while( NULL != (jsdscript = jsd_IterateScripts(jsdc, &iterp)) )
|
||||
while( nullptr != (jsdscript = jsd_IterateScripts(jsdc, &iterp)) )
|
||||
_dumpJSDScript( jsdc, jsdscript, " script: " );
|
||||
}
|
||||
#endif /* JSD_DUMP */
|
||||
@@ -347,7 +347,7 @@ jsd_ClearScriptProfileData(JSDContext* jsdc, JSDScript *script)
|
||||
if (script->profileData)
|
||||
{
|
||||
free(script->profileData);
|
||||
script->profileData = NULL;
|
||||
script->profileData = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ jsd_IterateScripts(JSDContext* jsdc, JSDScript **iterp)
|
||||
if( !jsdscript )
|
||||
jsdscript = (JSDScript *)jsdc->scripts.next;
|
||||
if( jsdscript == (JSDScript *)&jsdc->scripts )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
*iterp = (JSDScript*) jsdscript->links.next;
|
||||
return jsdscript;
|
||||
}
|
||||
@@ -423,7 +423,7 @@ jsd_GetScriptFunctionId(JSDContext* jsdc, JSDScript *jsdscript)
|
||||
JSFunction *fun = jsd_GetJSFunction(jsdc, jsdscript);
|
||||
|
||||
if( ! fun )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
str = JS_GetFunctionId(fun);
|
||||
|
||||
/* For compatibility we return "anonymous", not an empty string here. */
|
||||
@@ -561,7 +561,7 @@ jsd_NewScriptHookProc(
|
||||
JSFunction *fun,
|
||||
void* callerdata )
|
||||
{
|
||||
JSDScript* jsdscript = NULL;
|
||||
JSDScript* jsdscript = nullptr;
|
||||
JSDContext* jsdc = (JSDContext*) callerdata;
|
||||
JSD_ScriptHookProc hook;
|
||||
void* hookData;
|
||||
@@ -602,7 +602,7 @@ jsd_DestroyScriptHookProc(
|
||||
JSScript *script_,
|
||||
void* callerdata )
|
||||
{
|
||||
JSDScript* jsdscript = NULL;
|
||||
JSDScript* jsdscript = nullptr;
|
||||
JSDContext* jsdc = (JSDContext*) callerdata;
|
||||
// NB: We're called during GC, so we can't push a cx. Root directly with
|
||||
// the runtime.
|
||||
@@ -630,7 +630,8 @@ jsd_DestroyScriptHookProc(
|
||||
|
||||
/* local in case hook gets cleared on another thread */
|
||||
JSD_LOCK();
|
||||
hook = (jsdscript->flags & JSD_SCRIPT_CALL_DESTROY_HOOK_BIT) ? jsdc->scriptHook : NULL;
|
||||
hook = (jsdscript->flags & JSD_SCRIPT_CALL_DESTROY_HOOK_BIT) ? jsdc->scriptHook
|
||||
: nullptr;
|
||||
hookData = jsdc->scriptHookData;
|
||||
JSD_UNLOCK();
|
||||
|
||||
@@ -664,7 +665,7 @@ _findHook(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc)
|
||||
if (jsdhook->pc == pc)
|
||||
return jsdhook;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -711,7 +712,7 @@ jsd_TrapHandler(JSContext *cx, JSScript *script_, jsbytecode *pc, jsval *rval,
|
||||
|
||||
JSD_LOCK();
|
||||
|
||||
if( NULL == (jsdc = jsd_JSDContextForJSContext(cx)) ||
|
||||
if( nullptr == (jsdc = jsd_JSDContextForJSContext(cx)) ||
|
||||
! _isActiveHook(jsdc, script, jsdhook) )
|
||||
{
|
||||
JSD_UNLOCK();
|
||||
@@ -819,7 +820,7 @@ jsd_ClearExecutionHook(JSDContext* jsdc,
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoCompartment ac(cx, jsdscript->script);
|
||||
JS_ClearTrap(cx, jsdscript->script,
|
||||
(jsbytecode*)pc, NULL, NULL );
|
||||
(jsbytecode*)pc, nullptr, nullptr);
|
||||
}
|
||||
|
||||
JS_REMOVE_LINK(&jsdhook->links);
|
||||
@@ -852,10 +853,10 @@ bool
|
||||
jsd_ClearAllExecutionHooks(JSDContext* jsdc)
|
||||
{
|
||||
JSDScript* jsdscript;
|
||||
JSDScript* iterp = NULL;
|
||||
JSDScript* iterp = nullptr;
|
||||
|
||||
JSD_LOCK();
|
||||
while( NULL != (jsdscript = jsd_IterateScripts(jsdc, &iterp)) )
|
||||
while( nullptr != (jsdscript = jsd_IterateScripts(jsdc, &iterp)) )
|
||||
jsd_ClearAllExecutionHooksForScript(jsdc, jsdscript);
|
||||
JSD_UNLOCK();
|
||||
return true;
|
||||
|
||||
@@ -37,7 +37,7 @@ _addNewFrame(JSDContext* jsdc,
|
||||
JSAbstractFramePtr frame)
|
||||
{
|
||||
JSDStackFrameInfo* jsdframe;
|
||||
JSDScript* jsdscript = NULL;
|
||||
JSDScript* jsdscript = nullptr;
|
||||
|
||||
JSD_LOCK_SCRIPTS(jsdc);
|
||||
jsdscript = jsd_FindJSDScript(jsdc, script);
|
||||
@@ -45,7 +45,7 @@ _addNewFrame(JSDContext* jsdc,
|
||||
if (!jsdscript || (jsdc->flags & JSD_HIDE_DISABLED_FRAMES &&
|
||||
!JSD_IS_DEBUG_ENABLED(jsdc, jsdscript)))
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!JSD_IS_DEBUG_ENABLED(jsdc, jsdscript))
|
||||
@@ -53,7 +53,7 @@ _addNewFrame(JSDContext* jsdc,
|
||||
|
||||
jsdframe = (JSDStackFrameInfo*) calloc(1, sizeof(JSDStackFrameInfo));
|
||||
if( ! jsdframe )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdframe->jsdthreadstate = jsdthreadstate;
|
||||
jsdframe->jsdscript = jsdscript;
|
||||
@@ -83,7 +83,7 @@ jsd_NewThreadState(JSDContext* jsdc, JSContext *cx )
|
||||
|
||||
jsdthreadstate = (JSDThreadState*)calloc(1, sizeof(JSDThreadState));
|
||||
if( ! jsdthreadstate )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdthreadstate->context = cx;
|
||||
jsdthreadstate->thread = JSD_CURRENT_THREAD();
|
||||
@@ -121,7 +121,7 @@ jsd_NewThreadState(JSDContext* jsdc, JSContext *cx )
|
||||
JS_INIT_CLIST(&jsdthreadstate->links);
|
||||
JS_EndRequest(jsdthreadstate->context);
|
||||
jsd_DestroyThreadState(jsdc, jsdthreadstate);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ jsd_NewThreadState(JSDContext* jsdc, JSContext *cx )
|
||||
if (jsdthreadstate->stackDepth == 0)
|
||||
{
|
||||
free(jsdthreadstate);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSD_LOCK_THREADSTATES(jsdc);
|
||||
@@ -182,7 +182,7 @@ jsd_GetCountOfStackFrames(JSDContext* jsdc, JSDThreadState* jsdthreadstate)
|
||||
JSDStackFrameInfo*
|
||||
jsd_GetStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate)
|
||||
{
|
||||
JSDStackFrameInfo* jsdframe = NULL;
|
||||
JSDStackFrameInfo* jsdframe = nullptr;
|
||||
|
||||
JSD_LOCK_THREADSTATES(jsdc);
|
||||
|
||||
@@ -196,7 +196,7 @@ jsd_GetStackFrame(JSDContext* jsdc, JSDThreadState* jsdthreadstate)
|
||||
JSContext *
|
||||
jsd_GetJSContext (JSDContext* jsdc, JSDThreadState* jsdthreadstate)
|
||||
{
|
||||
JSContext* cx = NULL;
|
||||
JSContext* cx = nullptr;
|
||||
|
||||
JSD_LOCK_THREADSTATES(jsdc);
|
||||
if( jsd_IsValidThreadState(jsdc, jsdthreadstate) )
|
||||
@@ -211,7 +211,7 @@ jsd_GetCallingStackFrame(JSDContext* jsdc,
|
||||
JSDThreadState* jsdthreadstate,
|
||||
JSDStackFrameInfo* jsdframe)
|
||||
{
|
||||
JSDStackFrameInfo* nextjsdframe = NULL;
|
||||
JSDStackFrameInfo* nextjsdframe = nullptr;
|
||||
|
||||
JSD_LOCK_THREADSTATES(jsdc);
|
||||
|
||||
@@ -229,7 +229,7 @@ jsd_GetScriptForStackFrame(JSDContext* jsdc,
|
||||
JSDThreadState* jsdthreadstate,
|
||||
JSDStackFrameInfo* jsdframe)
|
||||
{
|
||||
JSDScript* jsdscript = NULL;
|
||||
JSDScript* jsdscript = nullptr;
|
||||
|
||||
JSD_LOCK_THREADSTATES(jsdc);
|
||||
|
||||
@@ -264,7 +264,7 @@ jsd_GetCallObjectForStackFrame(JSDContext* jsdc,
|
||||
JSDStackFrameInfo* jsdframe)
|
||||
{
|
||||
JSObject* obj;
|
||||
JSDValue* jsdval = NULL;
|
||||
JSDValue* jsdval = nullptr;
|
||||
|
||||
JSD_LOCK_THREADSTATES(jsdc);
|
||||
|
||||
@@ -286,7 +286,7 @@ jsd_GetScopeChainForStackFrame(JSDContext* jsdc,
|
||||
JSDStackFrameInfo* jsdframe)
|
||||
{
|
||||
JS::RootedObject obj(jsdthreadstate->context);
|
||||
JSDValue* jsdval = NULL;
|
||||
JSDValue* jsdval = nullptr;
|
||||
|
||||
JSD_LOCK_THREADSTATES(jsdc);
|
||||
|
||||
@@ -309,7 +309,7 @@ jsd_GetThisForStackFrame(JSDContext* jsdc,
|
||||
JSDThreadState* jsdthreadstate,
|
||||
JSDStackFrameInfo* jsdframe)
|
||||
{
|
||||
JSDValue* jsdval = NULL;
|
||||
JSDValue* jsdval = nullptr;
|
||||
JSD_LOCK_THREADSTATES(jsdc);
|
||||
|
||||
if( jsd_IsValidFrameInThreadState(jsdc, jsdthreadstate, jsdframe) )
|
||||
@@ -332,7 +332,7 @@ jsd_GetIdForStackFrame(JSDContext* jsdc,
|
||||
JSDThreadState* jsdthreadstate,
|
||||
JSDStackFrameInfo* jsdframe)
|
||||
{
|
||||
JSString *rv = NULL;
|
||||
JSString *rv = nullptr;
|
||||
|
||||
JSD_LOCK_THREADSTATES(jsdc);
|
||||
|
||||
@@ -400,7 +400,7 @@ jsd_EvaluateUCScriptInStackFrame(JSDContext* jsdc,
|
||||
{
|
||||
bool retval;
|
||||
bool valid;
|
||||
JSExceptionState* exceptionState = NULL;
|
||||
JSExceptionState* exceptionState = nullptr;
|
||||
|
||||
JS_ASSERT(JSD_CURRENT_THREAD() == jsdthreadstate->thread);
|
||||
|
||||
@@ -437,7 +437,7 @@ jsd_EvaluateScriptInStackFrame(JSDContext* jsdc,
|
||||
{
|
||||
bool retval;
|
||||
bool valid;
|
||||
JSExceptionState* exceptionState = NULL;
|
||||
JSExceptionState* exceptionState = nullptr;
|
||||
|
||||
JS_ASSERT(JSD_CURRENT_THREAD() == jsdthreadstate->thread);
|
||||
|
||||
@@ -480,7 +480,7 @@ jsd_ValToStringInStackFrame(JSDContext* jsdc,
|
||||
JSD_UNLOCK_THREADSTATES(jsdc);
|
||||
|
||||
if( ! valid )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
cx = jsdthreadstate->context;
|
||||
JS_ASSERT(cx);
|
||||
@@ -537,7 +537,7 @@ _getContextForThreadState(JSDContext* jsdc, JSDThreadState* jsdthreadstate)
|
||||
JSD_UNLOCK_THREADSTATES(jsdc);
|
||||
if( valid )
|
||||
return jsdthreadstate->context;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
JSDValue*
|
||||
@@ -547,11 +547,11 @@ jsd_GetException(JSDContext* jsdc, JSDThreadState* jsdthreadstate)
|
||||
JS::RootedValue val(cx);
|
||||
|
||||
if(!(cx = _getContextForThreadState(jsdc, jsdthreadstate)))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if(JS_GetPendingException(cx, &val))
|
||||
return jsd_NewValue(jsdc, val);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -20,7 +20,7 @@ static char*
|
||||
_indentSpaces(int i)
|
||||
{
|
||||
#define MAX_INDENT 63
|
||||
static char* p = NULL;
|
||||
static char* p = nullptr;
|
||||
if(!p)
|
||||
{
|
||||
p = calloc(1, MAX_INDENT+1);
|
||||
@@ -35,10 +35,10 @@ static void
|
||||
_interpreterTrace(JSDContext* jsdc, JSContext *cx, JSAbstractFramePtr frame,
|
||||
bool isConstructing, bool before)
|
||||
{
|
||||
JSDScript* jsdscript = NULL;
|
||||
JSDScript* jsdscript = nullptr;
|
||||
JSScript * script;
|
||||
static indent = 0;
|
||||
JSString* funName = NULL;
|
||||
JSString* funName = nullptr;
|
||||
|
||||
script = frame.script();
|
||||
if(script)
|
||||
@@ -200,7 +200,7 @@ _callHook(JSDContext *jsdc, JSContext *cx, JSAbstractFramePtr frame, bool isCons
|
||||
/* Current function is now our caller. */
|
||||
jsdc->callingFunctionPData = pdata->caller;
|
||||
/* No hanging pointers, please. */
|
||||
pdata->caller = NULL;
|
||||
pdata->caller = nullptr;
|
||||
/* Mark the time we returned, and indicate this
|
||||
* function is no longer running. */
|
||||
jsdc->lastReturnTime = now;
|
||||
@@ -255,7 +255,7 @@ jsd_FunctionCallHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructin
|
||||
return closure;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void *
|
||||
@@ -281,6 +281,6 @@ jsd_TopLevelCallHook(JSContext *cx, JSAbstractFramePtr frame, bool isConstructin
|
||||
return closure;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ _clearText(JSDContext* jsdc, JSDSourceText* jsdsrc)
|
||||
{
|
||||
if( jsdsrc->text )
|
||||
free(jsdsrc->text);
|
||||
jsdsrc->text = NULL;
|
||||
jsdsrc->text = nullptr;
|
||||
jsdsrc->textLength = 0;
|
||||
jsdsrc->textSpace = 0;
|
||||
jsdsrc->status = JSD_SOURCE_CLEARED;
|
||||
@@ -85,7 +85,7 @@ _newSource(JSDContext* jsdc, char* url)
|
||||
{
|
||||
JSDSourceText* jsdsrc = (JSDSourceText*)calloc(1,sizeof(JSDSourceText));
|
||||
if( ! jsdsrc )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdsrc->url = url;
|
||||
jsdsrc->status = JSD_SOURCE_INITED;
|
||||
@@ -98,7 +98,7 @@ _newSource(JSDContext* jsdc, char* url)
|
||||
static void
|
||||
_destroySource(JSDContext* jsdc, JSDSourceText* jsdsrc)
|
||||
{
|
||||
JS_ASSERT(NULL == jsdsrc->text); /* must _clearText() first */
|
||||
JS_ASSERT(nullptr == jsdsrc->text); /* must _clearText() first */
|
||||
free(jsdsrc->url);
|
||||
free(jsdsrc);
|
||||
}
|
||||
@@ -116,7 +116,7 @@ _addSource(JSDContext* jsdc, char* url)
|
||||
{
|
||||
JSDSourceText* jsdsrc = _newSource(jsdc, url);
|
||||
if( ! jsdsrc )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
JS_INSERT_LINK(&jsdsrc->links, &jsdc->sources);
|
||||
return jsdsrc;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ jsd_BuildNormalizedURL( const char* url_string )
|
||||
char *new_url_string;
|
||||
|
||||
if( ! url_string )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!strncasecomp(url_string, file_url_prefix, FILE_URL_PREFIX_LEN) &&
|
||||
url_string[FILE_URL_PREFIX_LEN + 0] == '/' &&
|
||||
@@ -230,7 +230,7 @@ jsd_IterateSources(JSDContext* jsdc, JSDSourceText **iterp)
|
||||
if( !jsdsrc )
|
||||
jsdsrc = (JSDSourceText *)jsdc->sources.next;
|
||||
if( jsdsrc == (JSDSourceText *)&jsdc->sources )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
*iterp = (JSDSourceText *)jsdsrc->links.next;
|
||||
return jsdsrc;
|
||||
}
|
||||
@@ -247,7 +247,7 @@ jsd_FindSourceForURL(JSDContext* jsdc, const char* url)
|
||||
if( 0 == strcmp(jsdsrc->url, url) )
|
||||
return jsdsrc;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char*
|
||||
@@ -310,11 +310,11 @@ jsd_IncrementSourceAlterCount(JSDContext* jsdc, JSDSourceText* jsdsrc)
|
||||
#if defined(DEBUG) && 0
|
||||
void DEBUG_ITERATE_SOURCES( JSDContext* jsdc )
|
||||
{
|
||||
JSDSourceText* iterp = NULL;
|
||||
JSDSourceText* jsdsrc = NULL;
|
||||
JSDSourceText* iterp = nullptr;
|
||||
JSDSourceText* jsdsrc = nullptr;
|
||||
int dummy;
|
||||
|
||||
while( NULL != (jsdsrc = jsd_IterateSources(jsdc, &iterp)) )
|
||||
while( nullptr != (jsdsrc = jsd_IterateSources(jsdc, &iterp)) )
|
||||
{
|
||||
const char* url;
|
||||
const char* text;
|
||||
@@ -348,7 +348,7 @@ jsd_NewSourceText(JSDContext* jsdc, const char* url)
|
||||
new_url_string = jsd_BuildNormalizedURL(url);
|
||||
|
||||
if( ! new_url_string )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsdsrc = jsd_FindSourceForURL(jsdc, new_url_string);
|
||||
|
||||
@@ -358,7 +358,7 @@ jsd_NewSourceText(JSDContext* jsdc, const char* url)
|
||||
{
|
||||
free(new_url_string);
|
||||
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
_moveSourceToRemovedList(jsdc, jsdsrc);
|
||||
@@ -383,14 +383,14 @@ jsd_AppendSourceText(JSDContext* jsdc,
|
||||
if( jsdsrc->doingEval )
|
||||
{
|
||||
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if( ! _isSourceInSourceList( jsdc, jsdsrc ) )
|
||||
{
|
||||
_removeSourceFromRemovedList( jsdc, jsdsrc );
|
||||
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if( text && length && ! _appendText( jsdc, jsdsrc, text, length ) )
|
||||
@@ -400,7 +400,7 @@ jsd_AppendSourceText(JSDContext* jsdc,
|
||||
jsdsrc->status = JSD_SOURCE_FAILED;
|
||||
_moveSourceToRemovedList(jsdc, jsdsrc);
|
||||
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
jsdsrc->dirty = true;
|
||||
@@ -419,11 +419,11 @@ jsd_AppendUCSourceText(JSDContext* jsdc,
|
||||
JSDSourceStatus status)
|
||||
{
|
||||
#define UNICODE_TRUNCATE_BUF_SIZE 1024
|
||||
static char* buf = NULL;
|
||||
static char* buf = nullptr;
|
||||
int remaining = length;
|
||||
|
||||
if(!text || !length)
|
||||
return jsd_AppendSourceText(jsdc, jsdsrc, NULL, 0, status);
|
||||
return jsd_AppendSourceText(jsdc, jsdsrc, nullptr, 0, status);
|
||||
|
||||
JSD_LOCK_SOURCE_TEXT(jsdc);
|
||||
if(!buf)
|
||||
@@ -432,7 +432,7 @@ jsd_AppendUCSourceText(JSDContext* jsdc,
|
||||
if(!buf)
|
||||
{
|
||||
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
while(remaining && jsdsrc) {
|
||||
@@ -446,7 +446,7 @@ jsd_AppendUCSourceText(JSDContext* jsdc,
|
||||
remaining -= bytes;
|
||||
}
|
||||
if(jsdsrc && status != JSD_SOURCE_PARTIAL)
|
||||
jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc, NULL, 0, status);
|
||||
jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc, nullptr, 0, status);
|
||||
|
||||
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||
return jsdsrc;
|
||||
@@ -469,7 +469,7 @@ jsd_AddFullSourceText(JSDContext* jsdc,
|
||||
text, length, JSD_SOURCE_PARTIAL );
|
||||
if( jsdsrc )
|
||||
jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc,
|
||||
NULL, 0, JSD_SOURCE_COMPLETED );
|
||||
nullptr, 0, JSD_SOURCE_COMPLETED );
|
||||
|
||||
JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||
|
||||
|
||||
@@ -197,12 +197,12 @@ jsd_GetValueString(JSDContext* jsdc, JSDValue* jsdval)
|
||||
stringval = STRING_TO_JSVAL(string);
|
||||
}
|
||||
if(!string || !JS_WrapValue(cx, stringval.address())) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
jsdval->string = JSVAL_TO_STRING(stringval);
|
||||
if(!JS_AddNamedStringRoot(cx, &jsdval->string, "ValueString"))
|
||||
jsdval->string = NULL;
|
||||
jsdval->string = nullptr;
|
||||
|
||||
return jsdval->string;
|
||||
}
|
||||
@@ -219,7 +219,7 @@ jsd_GetValueFunctionId(JSDContext* jsdc, JSDValue* jsdval)
|
||||
AutoSaveExceptionState as(cx);
|
||||
fun = JSD_GetValueFunction(jsdc, jsdval);
|
||||
if(!fun)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
jsdval->funName = JS_GetFunctionId(fun);
|
||||
|
||||
/* For compatibility we return "anonymous", not an empty string here. */
|
||||
@@ -244,7 +244,7 @@ jsd_NewValue(JSDContext* jsdc, jsval value)
|
||||
JSDValue* jsdval;
|
||||
|
||||
if(!(jsdval = (JSDValue*) calloc(1, sizeof(JSDValue))))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if(JSVAL_IS_GCTHING(val))
|
||||
{
|
||||
@@ -261,7 +261,7 @@ jsd_NewValue(JSDContext* jsdc, jsval value)
|
||||
if(!ok)
|
||||
{
|
||||
free(jsdval);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
jsdval->val = val;
|
||||
@@ -316,7 +316,7 @@ static JSDProperty* _newProperty(JSDContext* jsdc, JS::HandleValue propId,
|
||||
JSDProperty* jsdprop;
|
||||
|
||||
if(!(jsdprop = (JSDProperty*) calloc(1, sizeof(JSDProperty))))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JS_INIT_CLIST(&jsdprop->links);
|
||||
jsdprop->nref = 1;
|
||||
@@ -335,7 +335,7 @@ static JSDProperty* _newProperty(JSDContext* jsdc, JS::HandleValue propId,
|
||||
return jsdprop;
|
||||
new_prop_fail:
|
||||
jsd_DropProperty(jsdc, jsdprop);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void _freeProps(JSDContext* jsdc, JSDValue* jsdval)
|
||||
@@ -399,7 +399,7 @@ static bool _buildProps(JSDContext* jsdc, JSDValue* jsdval)
|
||||
}
|
||||
|
||||
#undef DROP_CLEAR_VALUE
|
||||
#define DROP_CLEAR_VALUE(jsdc, x) if(x){jsd_DropValue(jsdc,x); x = NULL;}
|
||||
#define DROP_CLEAR_VALUE(jsdc, x) if(x){jsd_DropValue(jsdc,x); x = nullptr;}
|
||||
|
||||
void
|
||||
jsd_RefreshValue(JSDContext* jsdc, JSDValue* jsdval)
|
||||
@@ -413,11 +413,11 @@ jsd_RefreshValue(JSDContext* jsdc, JSDValue* jsdval)
|
||||
JSAutoCompartment ac(cx, jsdc->glob);
|
||||
JS_RemoveStringRoot(cx, &jsdval->string);
|
||||
}
|
||||
jsdval->string = NULL;
|
||||
jsdval->string = nullptr;
|
||||
}
|
||||
|
||||
jsdval->funName = NULL;
|
||||
jsdval->className = NULL;
|
||||
jsdval->funName = nullptr;
|
||||
jsdval->className = nullptr;
|
||||
DROP_CLEAR_VALUE(jsdc, jsdval->proto);
|
||||
DROP_CLEAR_VALUE(jsdc, jsdval->parent);
|
||||
DROP_CLEAR_VALUE(jsdc, jsdval->ctor);
|
||||
@@ -454,13 +454,13 @@ jsd_IterateProperties(JSDContext* jsdc, JSDValue* jsdval, JSDProperty **iterp)
|
||||
{
|
||||
JS_ASSERT(!jsdprop);
|
||||
if(!_buildProps(jsdc, jsdval))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if(!jsdprop)
|
||||
jsdprop = (JSDProperty*)jsdval->props.next;
|
||||
if(jsdprop == (JSDProperty*)&jsdval->props)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
*iterp = (JSDProperty*)jsdprop->links.next;
|
||||
|
||||
JS_ASSERT(jsdprop);
|
||||
@@ -475,7 +475,7 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoCompartment acBase(cx, jsdc->glob);
|
||||
JSDProperty* jsdprop;
|
||||
JSDProperty* iter = NULL;
|
||||
JSDProperty* iter = nullptr;
|
||||
JS::RootedObject obj(cx);
|
||||
bool found;
|
||||
JS::RootedValue val(cx), nameval(cx);
|
||||
@@ -486,10 +486,10 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
||||
uint8_t propFlags;
|
||||
|
||||
if(!jsd_IsValueObject(jsdc, jsdval))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
/* If we already have the prop, then return it */
|
||||
while(NULL != (jsdprop = jsd_IterateProperties(jsdc, jsdval, &iter)))
|
||||
while(nullptr != (jsdprop = jsd_IterateProperties(jsdc, jsdval, &iter)))
|
||||
{
|
||||
JSString* propName = jsd_GetValueString(jsdc, jsdprop->name);
|
||||
if(propName) {
|
||||
@@ -503,10 +503,10 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
||||
|
||||
nameval = STRING_TO_JSVAL(name);
|
||||
if(!JS_ValueToId(cx, nameval, nameid.address()))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if(!(obj = JSVAL_TO_OBJECT(jsdval->val)))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JS::Rooted<JSPropertyDescriptor> desc(cx);
|
||||
{
|
||||
@@ -514,11 +514,11 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
||||
JS::RootedId id(cx, nameid);
|
||||
|
||||
if(!JS_WrapId(cx, id.address()))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if(!JS_GetOwnPropertyDescriptorById(cx, obj, id, 0, &desc))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if(!desc.object())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JS_ClearPendingException(cx);
|
||||
|
||||
@@ -528,7 +528,7 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
||||
{
|
||||
if (!JS_GetPendingException(cx, &propValue))
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
propFlags = JSPD_EXCEPTION;
|
||||
}
|
||||
@@ -545,7 +545,7 @@ jsd_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* nameStr)
|
||||
}
|
||||
|
||||
if (!JS_IdToValue(cx, nameid, propId.address()))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
propAlias = JSVAL_NULL;
|
||||
propFlags |= desc.isEnumerable() ? JSPD_ENUMERATE : 0
|
||||
@@ -568,7 +568,7 @@ jsd_GetValueFunction(JSDContext* jsdc, JSDValue* jsdval)
|
||||
JS::RootedFunction fun(cx);
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
obj = js::UncheckedUnwrap(JSVAL_TO_OBJECT(jsdval->val));
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
@@ -588,12 +588,12 @@ jsd_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval)
|
||||
JS_ASSERT(!jsdval->proto);
|
||||
SET_BIT_FLAG(jsdval->flags, GOT_PROTO);
|
||||
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
obj = JSVAL_TO_OBJECT(jsdval->val);
|
||||
if(!JS_GetPrototype(cx, obj, &proto))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if(!proto)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
jsdval->proto = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(proto));
|
||||
}
|
||||
if(jsdval->proto)
|
||||
@@ -612,14 +612,14 @@ jsd_GetValueParent(JSDContext* jsdc, JSDValue* jsdval)
|
||||
JS_ASSERT(!jsdval->parent);
|
||||
SET_BIT_FLAG(jsdval->flags, GOT_PARENT);
|
||||
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
obj = JSVAL_TO_OBJECT(jsdval->val);
|
||||
{
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
parent = JS_GetParentOrScopeChain(cx, obj);
|
||||
}
|
||||
if(!parent)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
jsdval->parent = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(parent));
|
||||
}
|
||||
if(jsdval->parent)
|
||||
@@ -639,18 +639,18 @@ jsd_GetValueConstructor(JSDContext* jsdc, JSDValue* jsdval)
|
||||
JS_ASSERT(!jsdval->ctor);
|
||||
SET_BIT_FLAG(jsdval->flags, GOT_CTOR);
|
||||
if(JSVAL_IS_PRIMITIVE(jsdval->val))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
obj = JSVAL_TO_OBJECT(jsdval->val);
|
||||
if(!JS_GetPrototype(cx, obj, &proto))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if(!proto)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
{
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
ctor = JS_GetConstructor(cx, proto);
|
||||
}
|
||||
if(!ctor)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
jsdval->ctor = jsd_NewValue(jsdc, OBJECT_TO_JSVAL(ctor));
|
||||
}
|
||||
if(jsdval->ctor)
|
||||
@@ -677,12 +677,12 @@ jsd_GetScriptForValue(JSDContext* jsdc, JSDValue* jsdval)
|
||||
{
|
||||
AutoSafeJSContext cx;
|
||||
JS::RootedValue val(cx, jsdval->val);
|
||||
JSFunction* fun = NULL;
|
||||
JSFunction* fun = nullptr;
|
||||
JS::RootedScript script(cx);
|
||||
JSDScript* jsdscript;
|
||||
|
||||
if (!jsd_IsValueFunction(jsdc, jsdval))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
{
|
||||
JSAutoCompartment ac(cx, JSVAL_TO_OBJECT(val));
|
||||
@@ -693,7 +693,7 @@ jsd_GetScriptForValue(JSDContext* jsdc, JSDValue* jsdval)
|
||||
}
|
||||
|
||||
if (!script)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JSD_LOCK_SCRIPTS(jsdc);
|
||||
jsdscript = jsd_FindJSDScript(jsdc, script);
|
||||
|
||||
@@ -975,7 +975,7 @@ jsdScript::CreatePPLineMap()
|
||||
{
|
||||
AutoSafeJSContext cx;
|
||||
JSAutoCompartment ac(cx, JSD_GetDefaultGlobal (mCx)); // Just in case.
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));
|
||||
if (!obj)
|
||||
return nullptr;
|
||||
JS::RootedFunction fun(cx, JSD_GetJSFunction (mCx, mScript));
|
||||
@@ -1142,7 +1142,7 @@ jsdScript::Invalidate()
|
||||
(JSD_GetScriptPrivate(mScript));
|
||||
NS_ASSERTION (script == this, "That's not my script!");
|
||||
NS_RELEASE(script);
|
||||
JSD_SetScriptPrivate(mScript, NULL);
|
||||
JSD_SetScriptPrivate(mScript, nullptr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1154,10 +1154,10 @@ jsdScript::InvalidateAll ()
|
||||
return;
|
||||
|
||||
JSDScript *script;
|
||||
JSDScript *iter = NULL;
|
||||
JSDScript *iter = nullptr;
|
||||
|
||||
JSD_LockScriptSubsystem(cx);
|
||||
while((script = JSD_IterateScripts(cx, &iter)) != NULL) {
|
||||
while((script = JSD_IterateScripts(cx, &iter)) != nullptr) {
|
||||
nsCOMPtr<jsdIScript> jsdis =
|
||||
static_cast<jsdIScript *>(JSD_GetScriptPrivate(script));
|
||||
if (jsdis)
|
||||
@@ -1460,7 +1460,8 @@ jsdScript::GetExecutableLines(uint32_t aPcmap, uint32_t aStartLine, uint32_t aMa
|
||||
uintptr_t end = JSD_GetClosestPC(mCx, mScript, lastLine + 1);
|
||||
|
||||
*aExecutableLines = static_cast<uint32_t*>(NS_Alloc((end - start + 1) * sizeof(uint32_t)));
|
||||
if (!JSD_GetLinePCs(mCx, mScript, aStartLine, aMaxLines, aCount, aExecutableLines, NULL))
|
||||
if (!JSD_GetLinePCs(mCx, mScript, aStartLine, aMaxLines, aCount, aExecutableLines,
|
||||
nullptr))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return NS_OK;
|
||||
@@ -1529,7 +1530,7 @@ jsdScript::SetBreakpoint(uint32_t aPC)
|
||||
{
|
||||
ASSERT_VALID_EPHEMERAL;
|
||||
uintptr_t pc = mFirstPC + aPC;
|
||||
JSD_SetExecutionHook (mCx, mScript, pc, jsds_ExecutionHookProc, NULL);
|
||||
JSD_SetExecutionHook (mCx, mScript, pc, jsds_ExecutionHookProc, nullptr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -2269,7 +2270,7 @@ jsdValue::GetProperties (jsdIProperty ***propArray, uint32_t *length)
|
||||
NS_ENSURE_TRUE(pa_temp, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
uint32_t i = 0;
|
||||
JSDProperty *iter = NULL;
|
||||
JSDProperty *iter = nullptr;
|
||||
JSDProperty *prop;
|
||||
while ((prop = JSD_IterateProperties (mCx, mValue, &iter))) {
|
||||
pa_temp[i] = jsdProperty::FromPtr (mCx, prop);
|
||||
@@ -2441,8 +2442,8 @@ jsdService::DeactivateDebugger ()
|
||||
jsdStackFrame::InvalidateAll();
|
||||
ClearAllBreakpoints();
|
||||
|
||||
JSD_SetErrorReporter (mCx, NULL, NULL);
|
||||
JSD_SetScriptHook (mCx, NULL, NULL);
|
||||
JSD_SetErrorReporter (mCx, nullptr, nullptr);
|
||||
JSD_SetScriptHook (mCx, nullptr, nullptr);
|
||||
JSD_ClearThrowHook (mCx);
|
||||
JSD_ClearInterruptHook (mCx);
|
||||
JSD_ClearDebuggerHook (mCx);
|
||||
@@ -2472,7 +2473,7 @@ jsdService::ActivateDebugger (JSRuntime *rt)
|
||||
/* condition indicates that the callback proc has not been set yet */
|
||||
gPrevGCSliceCallback = JS::SetGCSliceCallback (rt, jsds_GCSliceCallbackProc);
|
||||
|
||||
mCx = JSD_DebuggerOnForUser (rt, NULL, NULL);
|
||||
mCx = JSD_DebuggerOnForUser (rt, nullptr, nullptr);
|
||||
if (!mCx)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@@ -2492,29 +2493,29 @@ jsdService::ActivateDebugger (JSRuntime *rt)
|
||||
/* Start watching for script creation/destruction and manage jsdScript
|
||||
* objects accordingly
|
||||
*/
|
||||
JSD_SetScriptHook (mCx, jsds_ScriptHookProc, NULL);
|
||||
JSD_SetScriptHook (mCx, jsds_ScriptHookProc, nullptr);
|
||||
|
||||
/* If any of these mFooHook objects are installed, do the required JSD
|
||||
* hookup now. See also, jsdService::SetFooHook().
|
||||
*/
|
||||
if (mErrorHook)
|
||||
JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, NULL);
|
||||
JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, nullptr);
|
||||
if (mThrowHook)
|
||||
JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, NULL);
|
||||
JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||
/* can't ignore script callbacks, as we need to |Release| the wrapper
|
||||
* stored in private data when a script is deleted. */
|
||||
if (mInterruptHook)
|
||||
JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, NULL);
|
||||
JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||
if (mDebuggerHook)
|
||||
JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, NULL);
|
||||
JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||
if (mDebugHook)
|
||||
JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, NULL);
|
||||
JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||
if (mTopLevelHook)
|
||||
JSD_SetTopLevelHook (mCx, jsds_CallHookProc, NULL);
|
||||
JSD_SetTopLevelHook (mCx, jsds_CallHookProc, nullptr);
|
||||
else
|
||||
JSD_ClearTopLevelHook (mCx);
|
||||
if (mFunctionHook)
|
||||
JSD_SetFunctionHook (mCx, jsds_CallHookProc, NULL);
|
||||
JSD_SetFunctionHook (mCx, jsds_CallHookProc, nullptr);
|
||||
else
|
||||
JSD_ClearFunctionHook (mCx);
|
||||
mOn = true;
|
||||
@@ -2585,7 +2586,7 @@ jsdService::DoPause(uint32_t *_rval, bool internalCall)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
if (++mPauseLevel == 1) {
|
||||
JSD_SetErrorReporter (mCx, NULL, NULL);
|
||||
JSD_SetErrorReporter (mCx, nullptr, nullptr);
|
||||
JSD_ClearThrowHook (mCx);
|
||||
JSD_ClearInterruptHook (mCx);
|
||||
JSD_ClearDebuggerHook (mCx);
|
||||
@@ -2631,21 +2632,21 @@ jsdService::DoUnPause(uint32_t *_rval, bool internalCall)
|
||||
if (--mPauseLevel == 0 && mOn) {
|
||||
JSD_DebuggerUnpause (mCx);
|
||||
if (mErrorHook)
|
||||
JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, NULL);
|
||||
JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, nullptr);
|
||||
if (mThrowHook)
|
||||
JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, NULL);
|
||||
JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||
if (mInterruptHook)
|
||||
JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, NULL);
|
||||
JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||
if (mDebuggerHook)
|
||||
JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, NULL);
|
||||
JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||
if (mDebugHook)
|
||||
JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, NULL);
|
||||
JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||
if (mTopLevelHook)
|
||||
JSD_SetTopLevelHook (mCx, jsds_CallHookProc, NULL);
|
||||
JSD_SetTopLevelHook (mCx, jsds_CallHookProc, nullptr);
|
||||
else
|
||||
JSD_ClearTopLevelHook (mCx);
|
||||
if (mFunctionHook)
|
||||
JSD_SetFunctionHook (mCx, jsds_CallHookProc, NULL);
|
||||
JSD_SetFunctionHook (mCx, jsds_CallHookProc, nullptr);
|
||||
else
|
||||
JSD_ClearFunctionHook (mCx);
|
||||
|
||||
@@ -2673,7 +2674,7 @@ jsdService::EnumerateContexts (jsdIContextEnumerator *enumerator)
|
||||
if (!enumerator)
|
||||
return NS_OK;
|
||||
|
||||
JSContext *iter = NULL;
|
||||
JSContext *iter = nullptr;
|
||||
JSContext *cx;
|
||||
|
||||
while ((cx = JS_ContextIterator (mRuntime, &iter)))
|
||||
@@ -2696,7 +2697,7 @@ jsdService::EnumerateScripts (jsdIScriptEnumerator *enumerator)
|
||||
ASSERT_VALID_CONTEXT;
|
||||
|
||||
JSDScript *script;
|
||||
JSDScript *iter = NULL;
|
||||
JSDScript *iter = nullptr;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
JSD_LockScriptSubsystem(mCx);
|
||||
@@ -2733,7 +2734,8 @@ jsdService::DumpHeap(const nsACString &fileName)
|
||||
if (!file) {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
} else {
|
||||
if (!JS_DumpHeap(JS_GetRuntime(nsContentUtils::GetSafeJSContext()), file, NULL, JSTRACE_OBJECT, NULL, (size_t)-1, NULL))
|
||||
if (!JS_DumpHeap(JS_GetRuntime(nsContentUtils::GetSafeJSContext()),
|
||||
file, nullptr, JSTRACE_OBJECT, nullptr, (size_t)-1, nullptr))
|
||||
rv = NS_ERROR_FAILURE;
|
||||
if (file != stdout)
|
||||
fclose(file);
|
||||
@@ -3003,9 +3005,9 @@ jsdService::SetErrorHook (jsdIErrorHook *aHook)
|
||||
return NS_OK;
|
||||
|
||||
if (aHook)
|
||||
JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, NULL);
|
||||
JSD_SetErrorReporter (mCx, jsds_ErrorHookProc, nullptr);
|
||||
else
|
||||
JSD_SetErrorReporter (mCx, NULL, NULL);
|
||||
JSD_SetErrorReporter (mCx, nullptr, nullptr);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -3047,7 +3049,7 @@ jsdService::SetDebugHook (jsdIExecutionHook *aHook)
|
||||
return NS_OK;
|
||||
|
||||
if (aHook)
|
||||
JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, NULL);
|
||||
JSD_SetDebugBreakHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||
else
|
||||
JSD_ClearDebugBreakHook (mCx);
|
||||
|
||||
@@ -3075,7 +3077,7 @@ jsdService::SetDebuggerHook (jsdIExecutionHook *aHook)
|
||||
return NS_OK;
|
||||
|
||||
if (aHook)
|
||||
JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, NULL);
|
||||
JSD_SetDebuggerHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||
else
|
||||
JSD_ClearDebuggerHook (mCx);
|
||||
|
||||
@@ -3103,7 +3105,7 @@ jsdService::SetInterruptHook (jsdIExecutionHook *aHook)
|
||||
return NS_OK;
|
||||
|
||||
if (aHook)
|
||||
JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, NULL);
|
||||
JSD_SetInterruptHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||
else
|
||||
JSD_ClearInterruptHook (mCx);
|
||||
|
||||
@@ -3131,7 +3133,7 @@ jsdService::SetScriptHook (jsdIScriptHook *aHook)
|
||||
return NS_OK;
|
||||
|
||||
if (aHook)
|
||||
JSD_SetScriptHook (mCx, jsds_ScriptHookProc, NULL);
|
||||
JSD_SetScriptHook (mCx, jsds_ScriptHookProc, nullptr);
|
||||
/* we can't unset it if !aHook, because we still need to see script
|
||||
* deletes in order to Release the jsdIScripts held in JSDScript
|
||||
* private data. */
|
||||
@@ -3159,7 +3161,7 @@ jsdService::SetThrowHook (jsdIExecutionHook *aHook)
|
||||
return NS_OK;
|
||||
|
||||
if (aHook)
|
||||
JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, NULL);
|
||||
JSD_SetThrowHook (mCx, jsds_ExecutionHookProc, nullptr);
|
||||
else
|
||||
JSD_ClearThrowHook (mCx);
|
||||
|
||||
@@ -3187,7 +3189,7 @@ jsdService::SetTopLevelHook (jsdICallHook *aHook)
|
||||
return NS_OK;
|
||||
|
||||
if (aHook)
|
||||
JSD_SetTopLevelHook (mCx, jsds_CallHookProc, NULL);
|
||||
JSD_SetTopLevelHook (mCx, jsds_CallHookProc, nullptr);
|
||||
else
|
||||
JSD_ClearTopLevelHook (mCx);
|
||||
|
||||
@@ -3215,7 +3217,7 @@ jsdService::SetFunctionHook (jsdICallHook *aHook)
|
||||
return NS_OK;
|
||||
|
||||
if (aHook)
|
||||
JSD_SetFunctionHook (mCx, jsds_CallHookProc, NULL);
|
||||
JSD_SetFunctionHook (mCx, jsds_CallHookProc, nullptr);
|
||||
else
|
||||
JSD_ClearFunctionHook (mCx);
|
||||
|
||||
@@ -3313,15 +3315,15 @@ NS_DEFINE_NAMED_CID(JSDSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(JSDASO_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kJSDCIDs[] = {
|
||||
{ &kJSDSERVICE_CID, false, NULL, jsdServiceConstructor },
|
||||
{ &kJSDASO_CID, false, NULL, jsdASObserverConstructor },
|
||||
{ NULL }
|
||||
{ &kJSDSERVICE_CID, false, nullptr, jsdServiceConstructor },
|
||||
{ &kJSDASO_CID, false, nullptr, jsdASObserverConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kJSDContracts[] = {
|
||||
{ jsdServiceCtrID, &kJSDSERVICE_CID },
|
||||
{ jsdARObserverCtrID, &kJSDASO_CID },
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module kJSDModule = {
|
||||
|
||||
@@ -18,7 +18,7 @@ JSD_DebuggerOnForUser(JSRuntime* jsrt,
|
||||
JSD_UserCallbacks* callbacks,
|
||||
void* user)
|
||||
{
|
||||
return jsd_DebuggerOnForUser(jsrt, callbacks, user, NULL);
|
||||
return jsd_DebuggerOnForUser(jsrt, callbacks, user, nullptr);
|
||||
}
|
||||
|
||||
JSD_PUBLIC_API(JSDContext*)
|
||||
|
||||
@@ -83,7 +83,7 @@ JSD_SetUserCallbacks(JSRuntime* jsrt,
|
||||
/*
|
||||
* Startup JSD.
|
||||
* This version of the init function requires that JSD_SetUserCallbacks()
|
||||
* has been previously called (with a non-NULL callback struct pointer)
|
||||
* has been previously called (with a non-nullptr callback struct pointer)
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDContext*)
|
||||
JSD_DebuggerOn(void);
|
||||
@@ -262,15 +262,15 @@ JSD_UnlockScriptSubsystem(JSDContext* jsdc);
|
||||
|
||||
/*
|
||||
* Iterate through all the active scripts for this JSDContext.
|
||||
* NOTE: must initialize iterp to NULL to start iteration.
|
||||
* NOTE: must initialize iterp to nullptr to start iteration.
|
||||
* NOTE: must lock and unlock the subsystem
|
||||
* example:
|
||||
*
|
||||
* JSDScript jsdscript;
|
||||
* JSDScript iter = NULL;
|
||||
* JSDScript iter = nullptr;
|
||||
*
|
||||
* JSD_LockScriptSubsystem(jsdc);
|
||||
* while((jsdscript = JSD_IterateScripts(jsdc, &iter)) != NULL) {
|
||||
* while((jsdscript = JSD_IterateScripts(jsdc, &iter)) != nullptr) {
|
||||
* *** use jsdscript here ***
|
||||
* }
|
||||
* JSD_UnlockScriptSubsystem(jsdc);
|
||||
@@ -395,8 +395,9 @@ extern JSD_PUBLIC_API(const char*)
|
||||
JSD_GetScriptFilename(JSDContext* jsdc, JSDScript *jsdscript);
|
||||
|
||||
/*
|
||||
* Get the function name associated with this script (NULL if not a function).
|
||||
* If the function does not have a name the result is the string "anonymous".
|
||||
* Get the function name associated with this script (nullptr if not a
|
||||
* function). If the function does not have a name the result is the
|
||||
* string "anonymous".
|
||||
* *** new for gecko 2.0 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSString *)
|
||||
@@ -464,9 +465,9 @@ JSD_GetClosestLine(JSDContext* jsdc, JSDScript* jsdscript, uintptr_t pc);
|
||||
|
||||
/*
|
||||
* Get a list of lines and the corresponding earliest PC for each (see
|
||||
* JSD_GetClosestPC). Lines with no PCs associated will not be returned. NULL
|
||||
* may be passed for either lines or pcs to avoid filling anything in for that
|
||||
* argument.
|
||||
* JSD_GetClosestPC). Lines with no PCs associated will not be returned.
|
||||
* nullptr may be passed for either lines or pcs to avoid filling anything in
|
||||
* for that argument.
|
||||
*/
|
||||
extern JSD_PUBLIC_API(bool)
|
||||
JSD_GetLinePCs(JSDContext* jsdc, JSDScript* jsdscript,
|
||||
@@ -557,7 +558,7 @@ JSD_IterateSources(JSDContext* jsdc, JSDSourceText **iterp);
|
||||
/*
|
||||
* Find the source text item for the given URL (or filename - or whatever
|
||||
* string the given embedding uses to describe source locations).
|
||||
* Returns NULL is not found.
|
||||
* Returns nullptr if not found.
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDSourceText*)
|
||||
JSD_FindSourceForURL(JSDContext* jsdc, const char* url);
|
||||
@@ -639,7 +640,7 @@ JSD_DestroyAllSources( JSDContext* jsdc );
|
||||
/*
|
||||
* Add a new item for a given URL. If an item already exists for the given URL
|
||||
* then the old item is removed.
|
||||
* 'url' may not be NULL.
|
||||
* 'url' may not be nullptr.
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDSourceText*)
|
||||
JSD_NewSourceText(JSDContext* jsdc, const char* url);
|
||||
@@ -647,8 +648,9 @@ JSD_NewSourceText(JSDContext* jsdc, const char* url);
|
||||
/*
|
||||
* Append text (or change status -- e.g. set completed) for a source text
|
||||
* item. Text need not be zero terminated. Callers should consider the returned
|
||||
* JSDSourceText to be the 'current' item for future use. This may return NULL
|
||||
* if called after this item has been replaced by a call to JSD_NewSourceText.
|
||||
* JSDSourceText to be the 'current' item for future use. This may return
|
||||
* nullptr if called after this item has been replaced by a call to
|
||||
* JSD_NewSourceText.
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDSourceText*)
|
||||
JSD_AppendSourceText(JSDContext* jsdc,
|
||||
@@ -681,7 +683,7 @@ JSD_AppendUCSourceText(JSDContext* jsdc,
|
||||
* text, length, JSD_SOURCE_PARTIAL);
|
||||
* if(jsdsrc)
|
||||
* jsdsrc = jsd_AppendSourceText(jsdc, jsdsrc,
|
||||
* NULL, 0, JSD_SOURCE_COMPLETED);
|
||||
* nullptr, 0, JSD_SOURCE_COMPLETED);
|
||||
* JSD_UNLOCK_SOURCE_TEXT(jsdc);
|
||||
* return jsdsrc ? true : false;
|
||||
*/
|
||||
@@ -1016,8 +1018,8 @@ JSD_ValToStringInStackFrame(JSDContext* jsdc,
|
||||
JS::Value val);
|
||||
|
||||
/*
|
||||
* Get the JSDValue currently being thrown as an exception (may be NULL).
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
||||
* Get the JSDValue currently being thrown as an exception (may be nullptr).
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||
* *** new for version 1.1 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDValue*)
|
||||
@@ -1129,7 +1131,7 @@ JSD_CurrentThread();
|
||||
|
||||
/*
|
||||
* Create a new JSDValue to wrap the given JS::Value
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||
* *** new for version 1.1 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDValue*)
|
||||
@@ -1308,7 +1310,7 @@ JSD_IterateProperties(JSDContext* jsdc, JSDValue* jsdval, JSDProperty **iterp);
|
||||
|
||||
/*
|
||||
* Get the JSDProperty for the property of this JSDVal with this name.
|
||||
* NOTE: must eventually release by calling JSD_DropProperty (if not NULL)
|
||||
* NOTE: must eventually release by calling JSD_DropProperty (if not nullptr)
|
||||
* *** new for version 1.1 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDProperty*)
|
||||
@@ -1316,7 +1318,7 @@ JSD_GetValueProperty(JSDContext* jsdc, JSDValue* jsdval, JSString* name);
|
||||
|
||||
/*
|
||||
* Get the prototype object for this JSDValue.
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||
* *** new for version 1.1 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDValue*)
|
||||
@@ -1324,7 +1326,7 @@ JSD_GetValuePrototype(JSDContext* jsdc, JSDValue* jsdval);
|
||||
|
||||
/*
|
||||
* Get the parent object for this JSDValue.
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||
* *** new for version 1.1 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDValue*)
|
||||
@@ -1332,7 +1334,7 @@ JSD_GetValueParent(JSDContext* jsdc, JSDValue* jsdval);
|
||||
|
||||
/*
|
||||
* Get the ctor object for this JSDValue (or likely its prototype's ctor).
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||
* *** new for version 1.1 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDValue*)
|
||||
@@ -1386,7 +1388,7 @@ JSD_GetPropertyName(JSDContext* jsdc, JSDProperty* jsdprop);
|
||||
|
||||
/*
|
||||
* Get the JSDValue represeting the current value of this property
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||
* *** new for version 1.1 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDValue*)
|
||||
@@ -1394,7 +1396,7 @@ JSD_GetPropertyValue(JSDContext* jsdc, JSDProperty* jsdprop);
|
||||
|
||||
/*
|
||||
* Get the JSDValue represeting the alias of this property (if JSDPD_ALIAS set)
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||
* *** new for version 1.1 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDValue*)
|
||||
@@ -1455,7 +1457,7 @@ JSD_GetWrappedObject(JSDContext* jsdc, JSDObject* jsdobj);
|
||||
|
||||
/*
|
||||
* Get the URL of the line of source that caused this object to be created.
|
||||
* May be NULL.
|
||||
* May be nullptr.
|
||||
* *** new for version 1.1 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(const char*)
|
||||
@@ -1471,7 +1473,7 @@ JSD_GetObjectNewLineNumber(JSDContext* jsdc, JSDObject* jsdobj);
|
||||
|
||||
/*
|
||||
* Get the URL of the line of source of the constructor for this object.
|
||||
* May be NULL.
|
||||
* May be nullptr.
|
||||
* *** new for version 1.1 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(const char*)
|
||||
@@ -1487,7 +1489,7 @@ JSD_GetObjectConstructorLineNumber(JSDContext* jsdc, JSDObject* jsdobj);
|
||||
|
||||
/*
|
||||
* Get the name of the constructor for this object.
|
||||
* May be NULL.
|
||||
* May be nullptr.
|
||||
* *** new for version 1.1 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(const char*)
|
||||
@@ -1495,7 +1497,7 @@ JSD_GetObjectConstructorName(JSDContext* jsdc, JSDObject* jsdobj);
|
||||
|
||||
/*
|
||||
* Get JSDObject representing this JSObject.
|
||||
* May return NULL.
|
||||
* May return nullptr.
|
||||
* *** new for version 1.1 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDObject*)
|
||||
@@ -1503,7 +1505,7 @@ JSD_GetJSDObjectForJSObject(JSDContext* jsdc, JSObject* jsobj);
|
||||
|
||||
/*
|
||||
* Get JSDObject representing this JSDValue.
|
||||
* May return NULL.
|
||||
* May return nullptr.
|
||||
* *** new for version 1.1 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDObject*)
|
||||
@@ -1511,7 +1513,7 @@ JSD_GetObjectForValue(JSDContext* jsdc, JSDValue* jsdval);
|
||||
|
||||
/*
|
||||
* Create a JSDValue to wrap (and root) this JSDObject.
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not NULL)
|
||||
* NOTE: must eventually release by calling JSD_DropValue (if not nullptr)
|
||||
* *** new for version 1.1 ****
|
||||
*/
|
||||
extern JSD_PUBLIC_API(JSDValue*)
|
||||
|
||||
@@ -82,14 +82,14 @@ JS_NewHashTable(uint32_t n, JSHashFunction keyHash,
|
||||
} else {
|
||||
n = CeilingLog2Size(n);
|
||||
if (int32_t(n) < 0)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!allocOps) allocOps = &defaultHashAllocOps;
|
||||
|
||||
ht = (JSHashTable*) allocOps->allocTable(allocPriv, sizeof *ht);
|
||||
if (!ht)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
memset(ht, 0, sizeof *ht);
|
||||
ht->shift = JS_HASH_BITS - n;
|
||||
n = JS_BIT(n);
|
||||
@@ -97,7 +97,7 @@ JS_NewHashTable(uint32_t n, JSHashFunction keyHash,
|
||||
ht->buckets = (JSHashEntry**) allocOps->allocTable(allocPriv, nb);
|
||||
if (!ht->buckets) {
|
||||
allocOps->freeTable(allocPriv, ht, nb);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
memset(ht->buckets, 0, nb);
|
||||
|
||||
@@ -120,7 +120,7 @@ JS_HashTableDestroy(JSHashTable *ht)
|
||||
n = NBUCKETS(ht);
|
||||
for (i = 0; i < n; i++) {
|
||||
hep = &ht->buckets[i];
|
||||
while ((he = *hep) != NULL) {
|
||||
while ((he = *hep) != nullptr) {
|
||||
*hep = he->next;
|
||||
allocOps->freeEntry(allocPriv, he, HT_FREE_ENTRY);
|
||||
}
|
||||
@@ -150,7 +150,7 @@ JS_HashTableRawLookup(JSHashTable *ht, JSHashNumber keyHash, const void *key)
|
||||
ht->nlookups++;
|
||||
#endif
|
||||
hep = hep0 = BUCKET_HEAD(ht, keyHash);
|
||||
while ((he = *hep) != NULL) {
|
||||
while ((he = *hep) != nullptr) {
|
||||
if (he->keyHash == keyHash && ht->keyCompare(key, he->key)) {
|
||||
/* Move to front of chain if not already there */
|
||||
if (hep != hep0) {
|
||||
@@ -208,7 +208,7 @@ Resize(JSHashTable *ht, uint32_t newshift)
|
||||
*/
|
||||
while (*hep)
|
||||
hep = &(*hep)->next;
|
||||
he->next = NULL;
|
||||
he->next = nullptr;
|
||||
*hep = he;
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **&hep,
|
||||
n = NBUCKETS(ht);
|
||||
if (ht->nentries >= OVERLOADED(n)) {
|
||||
if (!Resize(ht, ht->shift - 1))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#ifdef JS_HASHMETER
|
||||
ht->ngrows++;
|
||||
#endif
|
||||
@@ -241,7 +241,7 @@ JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **&hep,
|
||||
/* Make a new key value entry */
|
||||
he = ht->allocOps->allocEntry(ht->allocPriv, key);
|
||||
if (!he)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
he->keyHash = keyHash;
|
||||
he->key = key;
|
||||
he->value = value;
|
||||
@@ -259,7 +259,7 @@ JS_HashTableAdd(JSHashTable *ht, const void *key, void *value)
|
||||
|
||||
keyHash = ht->keyHash(key);
|
||||
hep = JS_HashTableRawLookup(ht, keyHash, key);
|
||||
if ((he = *hep) != NULL) {
|
||||
if ((he = *hep) != nullptr) {
|
||||
/* Hit; see if values match */
|
||||
if (ht->valueCompare(he->value, value)) {
|
||||
/* key,value pair is already present in table */
|
||||
@@ -299,7 +299,7 @@ JS_HashTableRemove(JSHashTable *ht, const void *key)
|
||||
|
||||
keyHash = ht->keyHash(key);
|
||||
hep = JS_HashTableRawLookup(ht, keyHash, key);
|
||||
if ((he = *hep) == NULL)
|
||||
if ((he = *hep) == nullptr)
|
||||
return false;
|
||||
|
||||
/* Hit; remove element */
|
||||
@@ -315,10 +315,10 @@ JS_HashTableLookup(JSHashTable *ht, const void *key)
|
||||
|
||||
keyHash = ht->keyHash(key);
|
||||
hep = JS_HashTableRawLookup(ht, keyHash, key);
|
||||
if ((he = *hep) != NULL) {
|
||||
if ((he = *hep) != nullptr) {
|
||||
return he->value;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -337,7 +337,7 @@ JS_HashTableEnumerateEntries(JSHashTable *ht, JSHashEnumerator f, void *arg)
|
||||
n = 0;
|
||||
for (bucket = ht->buckets; n != nlimit; ++bucket) {
|
||||
hep = bucket;
|
||||
while ((he = *hep) != NULL) {
|
||||
while ((he = *hep) != nullptr) {
|
||||
JS_ASSERT(n < nlimit);
|
||||
rv = f(he, n, arg);
|
||||
n++;
|
||||
|
||||
Reference in New Issue
Block a user