Bug 784739 - Switch from NULL to nullptr in ipc/. r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Fri, 23 Aug 2013 15:51:44 -0400
changeset 144166 b25a650ea03250fd143962d1398eb3716a8a984d
parent 144165 fd99696eb53dc3e7a163286bda4a5d4132186f29
child 144167 21f216a5e2f1bffee31b16558dc2fad1d5f2760e
push id2354
push userttaubert@mozilla.com
push dateMon, 26 Aug 2013 06:39:14 +0000
treeherderfx-team@4887845b1142 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs784739
milestone26.0a1
Bug 784739 - Switch from NULL to nullptr in ipc/. r=ehsan
ipc/app/MozillaRuntimeMain.cpp
ipc/dbus/DBusUtils.cpp
ipc/dbus/DBusUtils.h
ipc/ipdl/test/cxx/IPDLUnitTests.template.cpp
ipc/ipdl/test/cxx/TestCrashCleanup.cpp
ipc/ipdl/test/cxx/TestDataStructures.cpp
ipc/ipdl/test/cxx/TestFailedCtor.h
ipc/ipdl/test/cxx/TestRPCErrorCleanup.cpp
ipc/ipdl/test/cxx/TestRPCShutdownRace.cpp
ipc/testshell/TestShellParent.h
ipc/testshell/XPCShellEnvironment.cpp
--- a/ipc/app/MozillaRuntimeMain.cpp
+++ b/ipc/app/MozillaRuntimeMain.cpp
@@ -58,17 +58,17 @@ main(int argc, char* argv[])
     int err = setpriority(PRIO_PROCESS, 0, 0);
     MOZ_ASSERT(!err);
     LOGE_IF(err, "setpriority failed. Current process needs root permission.");
     android::ProcessState::self()->startThreadPool();
     setpriority(PRIO_PROCESS, 0, curPrio);
 #endif
 
 #if defined(XP_WIN) && defined(DEBUG_bent)
-    MessageBox(NULL, L"Hi", L"Hi", MB_OK);
+    MessageBox(nullptr, L"Hi", L"Hi", MB_OK);
 #endif
 
     // Check for the absolute minimum number of args we need to move
     // forward here. We expect the last arg to be the child process type.
     if (argc < 1)
       return 1;
     GeckoProcessType proctype = XRE_StringToChildProcessType(argv[--argc]);
 
--- a/ipc/dbus/DBusUtils.cpp
+++ b/ipc/dbus/DBusUtils.cpp
@@ -354,21 +354,21 @@ static dbus_bool_t dbus_func_args_async_
                                                void (*user_cb)(DBusMessage*,
                                                                void*),
                                                void *user,
                                                const char *path,
                                                const char *ifc,
                                                const char *func,
                                                int first_arg_type,
                                                va_list args) {
-  DBusMessage *msg = NULL;
+  DBusMessage *msg = nullptr;
   /* Compose the command */
   msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC, path, ifc, func);
 
-  if (msg == NULL) {
+  if (msg == nullptr) {
     LOG("Could not allocate D-Bus message object!");
     goto done;
   }
 
   /* append arguments */
   if (!dbus_message_append_args_valist(msg, first_arg_type, args)) {
     LOG("Could not append argument to method call!");
     goto done;
@@ -519,22 +519,22 @@ dbus_func_send_and_block(DBusConnection*
 
   if (aReply) {
     *aReply = t->GetReply();
   }
 
   return TRUE;
 }
 
-// If err is NULL, then any errors will be LOG'd, and free'd and the reply
-// will be NULL.
-// If err is not NULL, then it is assumed that dbus_error_init was already
+// If err is nullptr, then any errors will be LOG'd, and free'd and the reply
+// will be nullptr.
+// If err is not nullptr, then it is assumed that dbus_error_init was already
 // called, and error's will be returned to the caller without logging. The
-// return value is NULL iff an error was set. The client must free the error if
-// set.
+// return value is nullptr iff an error was set. The client must free the
+// error if set.
 DBusMessage* dbus_func_args_timeout_valist(DBusConnection* conn,
                                            int timeout_ms,
                                            DBusError* err,
                                            const char* path,
                                            const char* ifc,
                                            const char* func,
                                            int first_arg_type,
                                            va_list args)
@@ -586,17 +586,17 @@ DBusMessage * dbus_func_args(DBusConnect
                              const char *path,
                              const char *ifc,
                              const char *func,
                              int first_arg_type,
                              ...) {
   DBusMessage *ret;
   va_list lst;
   va_start(lst, first_arg_type);
-  ret = dbus_func_args_timeout_valist(conn, -1, NULL,
+  ret = dbus_func_args_timeout_valist(conn, -1, nullptr,
                                       path, ifc, func,
                                       first_arg_type, lst);
   va_end(lst);
   return ret;
 }
 
 DBusMessage * dbus_func_args_error(DBusConnection *conn,
                                    DBusError *err,
--- a/ipc/dbus/DBusUtils.h
+++ b/ipc/dbus/DBusUtils.h
@@ -88,17 +88,17 @@ protected:
     return *this;
   }
 };
 
 typedef void (*DBusCallback)(DBusMessage *, void *);
 
 void log_and_free_dbus_error(DBusError* err,
                              const char* function,
-                             DBusMessage* msg = NULL);
+                             DBusMessage* msg = nullptr);
 
 dbus_bool_t dbus_func_send(DBusConnection *aConnection,
                            dbus_uint32_t *aSerial,
                            DBusMessage *aMessage);
 
 dbus_bool_t dbus_func_args_send(DBusConnection *aConnection,
                                 dbus_uint32_t *aSerial,
                                 const char *aPath,
--- a/ipc/ipdl/test/cxx/IPDLUnitTests.template.cpp
+++ b/ipc/ipdl/test/cxx/IPDLUnitTests.template.cpp
@@ -36,17 +36,17 @@ void* gChildActor;
 Thread* gChildThread;
 MessageLoop *gParentMessageLoop;
 bool gParentDone;
 bool gChildDone;
 
 //-----------------------------------------------------------------------------
 // data/functions accessed by both parent and child processes
 
-char* gIPDLUnitTestName = NULL;
+char* gIPDLUnitTestName = nullptr;
 
 const char* const
 IPDLUnitTestName()
 {
     if (!gIPDLUnitTestName) {
 #if defined(OS_WIN)
         vector<wstring> args =
             CommandLine::ForCurrentProcess()->GetLooseValues();
@@ -98,17 +98,17 @@ IPDLUnitTestToString(IPDLUnitTestType aT
 {
     switch (aTest) {
 //-----------------------------------------------------------------------------
 //===== TEMPLATED =====
 ${ENUM_TO_STRINGS}
 //-----------------------------------------------------------------------------
 
     default:
-        return NULL;
+        return nullptr;
     }
 }
 
 
 IPDLUnitTestType
 IPDLUnitTest()
 {
     return IPDLUnitTestFromString(::mozilla::_ipdltest::IPDLUnitTestName());
--- a/ipc/ipdl/test/cxx/TestCrashCleanup.cpp
+++ b/ipc/ipdl/test/cxx/TestCrashCleanup.cpp
@@ -21,25 +21,25 @@ namespace {
 // NB: this test does its own shutdown, rather than going through
 // QuitParent(), because it's testing degenerate edge cases
 
 void DeleteSubprocess(Mutex* mutex, CondVar* cvar)
 {
     MutexAutoLock lock(*mutex);
 
     delete gSubprocess;
-    gSubprocess = NULL;
+    gSubprocess = nullptr;
 
     cvar->Notify();
 }
 
 void DeleteTheWorld()
 {
     delete static_cast<TestCrashCleanupParent*>(gParentActor);
-    gParentActor = NULL;
+    gParentActor = nullptr;
 
     // needs to be synchronous to avoid affecting event ordering on
     // the main thread
     Mutex mutex("TestCrashCleanup.DeleteTheWorld.mutex");
     CondVar cvar(mutex, "TestCrashCleanup.DeleteTheWorld.cvar");
 
     MutexAutoLock lock(mutex);
 
--- a/ipc/ipdl/test/cxx/TestDataStructures.cpp
+++ b/ipc/ipdl/test/cxx/TestDataStructures.cpp
@@ -946,17 +946,17 @@ TestDataStructuresChild::Test16()
 void
 TestDataStructuresChild::Test17()
 {
     Attrs attrs;
     attrs.common() = CommonAttrs(true);
     attrs.specific() = BarAttrs(1.0f);
 
     InfallibleTArray<Op> ops;
-    ops.AppendElement(SetAttrs(NULL, mKids[0], attrs));
+    ops.AppendElement(SetAttrs(nullptr, mKids[0], attrs));
 
     if (!SendTest17(ops))
         fail("sending Test17");
 
     printf("  passed %s\n", __FUNCTION__);
 }
 
 void
--- a/ipc/ipdl/test/cxx/TestFailedCtor.h
+++ b/ipc/ipdl/test/cxx/TestFailedCtor.h
@@ -75,17 +75,17 @@ protected:
 // First descendent
 //
 class TestFailedCtorSubsub;
 
 class TestFailedCtorSubParent :
     public PTestFailedCtorSubParent
 {
 public:
-    TestFailedCtorSubParent() : mOne(NULL), mTwo(NULL), mThree(NULL) { }
+    TestFailedCtorSubParent() : mOne(nullptr), mTwo(nullptr), mThree(nullptr) { }
     virtual ~TestFailedCtorSubParent();
 
 protected:
     virtual PTestFailedCtorSubsubParent* AllocPTestFailedCtorSubsubParent() MOZ_OVERRIDE;
 
     virtual bool DeallocPTestFailedCtorSubsubParent(PTestFailedCtorSubsubParent* actor) MOZ_OVERRIDE;
     virtual bool RecvSync() MOZ_OVERRIDE { return true; }
 
--- a/ipc/ipdl/test/cxx/TestRPCErrorCleanup.cpp
+++ b/ipc/ipdl/test/cxx/TestRPCErrorCleanup.cpp
@@ -21,25 +21,25 @@ namespace {
 // NB: this test does its own shutdown, rather than going through
 // QuitParent(), because it's testing degenerate edge cases
 
 void DeleteSubprocess(Mutex* mutex, CondVar* cvar)
 {
     MutexAutoLock lock(*mutex);
 
     delete gSubprocess;
-    gSubprocess = NULL;
+    gSubprocess = nullptr;
 
     cvar->Notify();
 }
 
 void DeleteTheWorld()
 {
     delete static_cast<TestRPCErrorCleanupParent*>(gParentActor);
-    gParentActor = NULL;
+    gParentActor = nullptr;
 
     // needs to be synchronous to avoid affecting event ordering on
     // the main thread
     Mutex mutex("TestRPCErrorCleanup.DeleteTheWorld.mutex");
     CondVar cvar(mutex, "TestRPCErrorCleanup.DeleteTheWorld.cvar");
 
     MutexAutoLock lock(mutex);
 
--- a/ipc/ipdl/test/cxx/TestRPCShutdownRace.cpp
+++ b/ipc/ipdl/test/cxx/TestRPCShutdownRace.cpp
@@ -20,17 +20,17 @@ namespace _ipdltest {
 namespace {
 
 // NB: this test does its own shutdown, rather than going through
 // QuitParent(), because it's testing degenerate edge cases
 
 void DeleteSubprocess()
 {
     delete gSubprocess;
-    gSubprocess = NULL;
+    gSubprocess = nullptr;
 }
 
 void Done()
 {
     passed(__FILE__);
     QuitParent();
 }
 
@@ -75,17 +75,17 @@ TestRPCShutdownRaceParent::StartShutting
     PR_Sleep(2000);
 
     if (CallExit())
         fail("connection was supposed to be interrupted");
 
     Close();
 
     delete static_cast<TestRPCShutdownRaceParent*>(gParentActor);
-    gParentActor = NULL;
+    gParentActor = nullptr;
 
     XRE_GetIOMessageLoop()->PostTask(FROM_HERE,
                                      NewRunnableFunction(DeleteSubprocess));
 
     // this is ordered after the OnMaybeDequeueOne event in the queue
     MessageLoop::current()->PostTask(FROM_HERE,
                                      NewRunnableFunction(Done));
 
--- a/ipc/testshell/TestShellParent.h
+++ b/ipc/testshell/TestShellParent.h
@@ -35,17 +35,17 @@ public:
   bool
   CommandDone(TestShellCommandParent* aActor, const nsString& aResponse);
 };
 
 
 class TestShellCommandParent : public PTestShellCommandParent
 {
 public:
-  TestShellCommandParent() : mCx(NULL) { }
+  TestShellCommandParent() : mCx(nullptr) { }
 
   bool SetCallback(JSContext* aCx, JS::Value aCallback);
 
   bool RunCallback(const nsString& aResponse);
 
   void ReleaseCallback();
 
 protected:
--- a/ipc/testshell/XPCShellEnvironment.cpp
+++ b/ipc/testshell/XPCShellEnvironment.cpp
@@ -276,21 +276,21 @@ GCZeal(JSContext *cx,
 #ifdef DEBUG
 
 static bool
 DumpHeap(JSContext *cx,
          unsigned argc,
          JS::Value *vp)
 {
     JSAutoByteString fileName;
-    void* startThing = NULL;
+    void* startThing = nullptr;
     JSGCTraceKind startTraceKind = JSTRACE_OBJECT;
-    void *thingToFind = NULL;
+    void *thingToFind = nullptr;
     size_t maxDepth = (size_t)-1;
-    void *thingToIgnore = NULL;
+    void *thingToIgnore = nullptr;
     FILE *dumpFile;
     bool ok;
 
     JS::Value *argv = JS_ARGV(cx, vp);
     JS_SET_RVAL(cx, vp, JSVAL_VOID);
 
     vp = argv + 0;
     if (argc > 0 && *vp != JSVAL_NULL && *vp != JSVAL_VOID) {
@@ -481,17 +481,17 @@ XPCShellEnvironment::ProcessFile(JSConte
             JS_CompileScriptForPrincipals(cx, obj, env->GetPrincipal(), buffer,
                                           strlen(buffer), "typein", startline);
         if (script) {
             JSErrorReporter older;
 
             ok = JS_ExecuteScript(cx, obj, script, result.address());
             if (ok && result != JSVAL_VOID) {
                 /* Suppress error reports from JS_ValueToString(). */
-                older = JS_SetErrorReporter(cx, NULL);
+                older = JS_SetErrorReporter(cx, nullptr);
                 str = JS_ValueToString(cx, result);
                 JSAutoByteString bytes;
                 if (str)
                     bytes.encodeLatin1(cx, str);
                 JS_SetErrorReporter(cx, older);
 
                 if (!!bytes)
                     fprintf(stdout, "%s\n", bytes.ptr());
@@ -697,17 +697,17 @@ XPCShellEnvironment::EvaluateString(cons
 
   if (aResult) {
       aResult->Truncate();
   }
 
   JS::Rooted<JS::Value> result(cx);
   bool ok = JS_ExecuteScript(cx, global, script, result.address());
   if (ok && result != JSVAL_VOID) {
-      JSErrorReporter old = JS_SetErrorReporter(cx, NULL);
+      JSErrorReporter old = JS_SetErrorReporter(cx, nullptr);
       JSString* str = JS_ValueToString(cx, result);
       nsDependentJSString depStr;
       if (str)
           depStr.init(cx, str);
       JS_SetErrorReporter(cx, old);
 
       if (!depStr.IsEmpty() && aResult) {
           aResult->Assign(depStr);