@@ -134,7 +134,7 @@ static bool RunningNatively()
134134{
135135 int ret = 0 ;
136136 size_t sz = sizeof (ret);
137- if (sysctlbyname (" sysctl.proc_native" , &ret, &sz, NULL , 0 ) != 0 )
137+ if (sysctlbyname (" sysctl.proc_native" , &ret, &sz, nullptr , 0 ) != 0 )
138138 {
139139 // if the sysctl failed, we'll assume this OS does not support
140140 // binary translation - so we must be running natively.
207207PALAPI
208208PAL_InitializeDLL ()
209209{
210- return Initialize (0 , NULL , g_initializeDLLFlags);
210+ return Initialize (0 , nullptr , g_initializeDLLFlags);
211211}
212212
213213/* ++
@@ -269,12 +269,12 @@ void
269269InitializeDefaultStackSize ()
270270{
271271 char * defaultStackSizeStr = getenv (" COMPlus_DefaultStackSize" );
272- if (defaultStackSizeStr != NULL )
272+ if (defaultStackSizeStr != nullptr )
273273 {
274274 errno = 0 ;
275275 // Like all numeric values specific by the COMPlus_xxx variables, it is a
276276 // hexadecimal string without any prefix.
277- long int size = strtol (defaultStackSizeStr, NULL , 16 );
277+ long int size = strtol (defaultStackSizeStr, nullptr , 16 );
278278
279279 if (errno == 0 )
280280 {
@@ -311,10 +311,10 @@ Initialize(
311311 DWORD flags)
312312{
313313 PAL_ERROR palError = ERROR_GEN_FAILURE;
314- CPalThread *pThread = NULL ;
315- CSharedMemoryObjectManager *pshmom = NULL ;
316- LPWSTR command_line = NULL ;
317- LPWSTR exe_path = NULL ;
314+ CPalThread *pThread = nullptr ;
315+ CSharedMemoryObjectManager *pshmom = nullptr ;
316+ LPWSTR command_line = nullptr ;
317+ LPWSTR exe_path = nullptr ;
318318 int retval = -1 ;
319319 bool fFirstTimeInit = false ;
320320
@@ -336,18 +336,18 @@ Initialize(
336336
337337 CriticalSectionSubSysInitialize ();
338338
339- if (NULL == init_critsec)
339+ if (nullptr == init_critsec)
340340 {
341341 pthread_mutex_lock (&init_critsec_mutex); // prevents race condition of two threads
342342 // initializing the critical section.
343- if (NULL == init_critsec)
343+ if (nullptr == init_critsec)
344344 {
345345 static CRITICAL_SECTION temp_critsec;
346346
347347 // Want this critical section to NOT be internal to avoid the use of unsafe region markers.
348348 InternalInitializeCriticalSectionAndSpinCount (&temp_critsec, 0 , false );
349349
350- if (NULL != InterlockedCompareExchangePointer (&init_critsec, &temp_critsec, NULL ))
350+ if (nullptr != InterlockedCompareExchangePointer (&init_critsec, &temp_critsec, nullptr ))
351351 {
352352 // Another thread got in before us! shouldn't happen, if the PAL
353353 // isn't initialized there shouldn't be any other threads
@@ -358,7 +358,7 @@ Initialize(
358358 pthread_mutex_unlock (&init_critsec_mutex);
359359 }
360360
361- InternalEnterCriticalSection (pThread, init_critsec); // here pThread is always NULL
361+ InternalEnterCriticalSection (pThread, init_critsec); // here pThread is always nullptr
362362
363363 if (init_count == 0 )
364364 {
@@ -407,12 +407,12 @@ Initialize(
407407
408408#ifdef FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION
409409 char * useDefaultBaseAddr = getenv (" COMPlus_UseDefaultBaseAddr" );
410- if (useDefaultBaseAddr != NULL )
410+ if (useDefaultBaseAddr != nullptr )
411411 {
412412 errno = 0 ;
413413 // Like all numeric values specific by the COMPlus_xxx variables, it is a
414414 // hexadecimal string without any prefix.
415- long int flag = strtol (useDefaultBaseAddr, NULL , 16 );
415+ long int flag = strtol (useDefaultBaseAddr, nullptr , 16 );
416416
417417 if (errno == 0 )
418418 {
@@ -508,7 +508,7 @@ Initialize(
508508 //
509509
510510 pshmom = InternalNew<CSharedMemoryObjectManager>();
511- if (NULL == pshmom)
511+ if (nullptr == pshmom)
512512 {
513513 ERROR (" Unable to allocate new object manager\n " );
514514 palError = ERROR_OUTOFMEMORY;
@@ -531,7 +531,7 @@ Initialize(
531531 g_pSynchronizationManager =
532532 CPalSynchMgrController::CreatePalSynchronizationManager ();
533533
534- if (NULL == g_pSynchronizationManager)
534+ if (nullptr == g_pSynchronizationManager)
535535 {
536536 palError = ERROR_NOT_ENOUGH_MEMORY;
537537 ERROR (" Failure creating synchronization manager\n " );
@@ -545,11 +545,11 @@ Initialize(
545545
546546 palError = ERROR_GEN_FAILURE;
547547
548- if (argc > 0 && argv != NULL )
548+ if (argc > 0 && argv != nullptr )
549549 {
550550 /* build the command line */
551551 command_line = INIT_FormatCommandLine (argc, argv);
552- if (NULL == command_line)
552+ if (nullptr == command_line)
553553 {
554554 ERROR (" Error building command line\n " );
555555 palError = ERROR_PALINIT_COMMAND_LINE;
@@ -558,7 +558,7 @@ Initialize(
558558
559559 /* find out the application's full path */
560560 exe_path = INIT_GetCurrentEXEPath ();
561- if (NULL == exe_path)
561+ if (nullptr == exe_path)
562562 {
563563 ERROR (" Unable to find exe path\n " );
564564 palError = ERROR_PALINIT_CONVERT_EXE_PATH;
@@ -576,7 +576,7 @@ Initialize(
576576 }
577577
578578 // InitializeProcessCommandLine took ownership of this memory.
579- command_line = NULL ;
579+ command_line = nullptr ;
580580
581581#ifdef PAL_PERF
582582 // Initialize the Profiling structure
@@ -597,7 +597,7 @@ Initialize(
597597 }
598598
599599 // LOADSetExeName took ownership of this memory.
600- exe_path = NULL ;
600+ exe_path = nullptr ;
601601 }
602602
603603 if (init_count == 0 )
@@ -742,7 +742,7 @@ Initialize(
742742
743743 if (fFirstTimeInit && 0 == retval)
744744 {
745- _ASSERTE (NULL != pThread);
745+ _ASSERTE (nullptr != pThread);
746746 }
747747
748748 if (retval != 0 && GetLastError () == ERROR_SUCCESS)
@@ -858,7 +858,7 @@ PAL_IsDebuggerPresent()
858858 struct kinfo_proc info = {};
859859 size_t size = sizeof (info);
860860 int mib[4 ] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid () };
861- int ret = sysctl (mib, sizeof (mib)/sizeof (*mib), &info, &size, NULL , 0 );
861+ int ret = sysctl (mib, sizeof (mib)/sizeof (*mib), &info, &size, nullptr , 0 );
862862
863863 if (ret == 0 )
864864 return ((info.kp_proc .p_flag & P_TRACED) != 0 );
@@ -871,12 +871,12 @@ PAL_IsDebuggerPresent()
871871
872872 struct kinfo_proc *info;
873873
874- kd = kvm_open (NULL , NULL , NULL , KVM_NO_FILES, " kvm_open" );
875- if (kd == NULL )
874+ kd = kvm_open (nullptr , nullptr , nullptr , KVM_NO_FILES, " kvm_open" );
875+ if (kd == nullptr )
876876 return FALSE ;
877877
878878 info = kvm_getprocs (kd, KERN_PROC_PID, getpid (), &cnt);
879- if (info == NULL || cnt < 1 )
879+ if (info == nullptr || cnt < 1 )
880880 {
881881 kvm_close (kd);
882882 return FALSE ;
@@ -960,7 +960,7 @@ PAL_TerminateEx(
960960{
961961 ENTRY_EXTERNAL (" PAL_TerminateEx()\n " );
962962
963- if (NULL == init_critsec)
963+ if (nullptr == init_critsec)
964964 {
965965 /* note that these macros probably won't output anything, since the
966966 debug channels haven't been initialized yet */
@@ -1057,7 +1057,7 @@ BOOL PALInitLock(void)
10571057 }
10581058
10591059 CPalThread * pThread =
1060- (PALIsThreadDataInitialized () ? InternalGetCurrentThread () : NULL );
1060+ (PALIsThreadDataInitialized () ? InternalGetCurrentThread () : nullptr );
10611061
10621062 InternalEnterCriticalSection (pThread, init_critsec);
10631063 return TRUE ;
@@ -1079,7 +1079,7 @@ void PALInitUnlock(void)
10791079 }
10801080
10811081 CPalThread * pThread =
1082- (PALIsThreadDataInitialized () ? InternalGetCurrentThread () : NULL );
1082+ (PALIsThreadDataInitialized () ? InternalGetCurrentThread () : nullptr );
10831083
10841084 InternalLeaveCriticalSection (pThread, init_critsec);
10851085}
@@ -1138,7 +1138,7 @@ static BOOL INIT_IncreaseDescriptorLimit(void)
11381138
11391139Parameters :
11401140 int argc : number of arguments in argv
1141- char **argv : argument list in an array of NULL -terminated strings
1141+ char **argv : argument list in an array of nullptr -terminated strings
11421142
11431143Return value :
11441144 pointer to Unicode command line. This is a buffer allocated with malloc;
@@ -1161,7 +1161,7 @@ Note : not all peculiarities of Windows command-line processing are supported;
11611161static LPWSTR INIT_FormatCommandLine (int argc, const char * const *argv)
11621162{
11631163 LPWSTR retval;
1164- LPSTR command_line=NULL , command_ptr;
1164+ LPSTR command_line=nullptr , command_ptr;
11651165 LPCSTR arg_ptr;
11661166 INT length, i,j;
11671167 BOOL bQuoted = FALSE ;
@@ -1186,7 +1186,7 @@ static LPWSTR INIT_FormatCommandLine (int argc, const char * const *argv)
11861186 if (!command_line)
11871187 {
11881188 ERROR (" couldn't allocate memory for command line!\n " );
1189- return NULL ;
1189+ return nullptr ;
11901190 }
11911191
11921192 command_ptr=command_line;
@@ -1220,32 +1220,32 @@ static LPWSTR INIT_FormatCommandLine (int argc, const char * const *argv)
12201220 }
12211221 *command_ptr++=' ' ;
12221222 }
1223- /* replace the last space with a NULL terminator */
1223+ /* replace the last space with a nullptr terminator */
12241224 command_ptr--;
12251225 *command_ptr=' \0 ' ;
12261226
12271227 /* convert to Unicode */
1228- i = MultiByteToWideChar (CP_ACP, 0 ,command_line, -1 , NULL , 0 );
1228+ i = MultiByteToWideChar (CP_ACP, 0 ,command_line, -1 , nullptr , 0 );
12291229 if (i == 0 )
12301230 {
12311231 ASSERT (" MultiByteToWideChar failure\n " );
12321232 free (command_line);
1233- return NULL ;
1233+ return nullptr ;
12341234 }
12351235
12361236 retval = reinterpret_cast <LPWSTR>(InternalMalloc ((sizeof (WCHAR)*i)));
1237- if (retval == NULL )
1237+ if (retval == nullptr )
12381238 {
12391239 ERROR (" can't allocate memory for Unicode command line!\n " );
12401240 free (command_line);
1241- return NULL ;
1241+ return nullptr ;
12421242 }
12431243
12441244 if (!MultiByteToWideChar (CP_ACP, 0 ,command_line, i, retval, i))
12451245 {
12461246 ASSERT (" MultiByteToWideChar failure\n " );
12471247 free (retval);
1248- retval = NULL ;
1248+ retval = nullptr ;
12491249 }
12501250 else
12511251 TRACE (" Command line is %s\n " , command_line);
@@ -1275,25 +1275,25 @@ static LPWSTR INIT_GetCurrentEXEPath()
12751275 if (!path)
12761276 {
12771277 ERROR ( " Cannot get current exe path\n " );
1278- return NULL ;
1278+ return nullptr ;
12791279 }
12801280
12811281 PathCharString real_path;
12821282 real_path.Set (path, strlen (path));
12831283 free (path);
12841284
1285- return_size = MultiByteToWideChar (CP_ACP, 0 , real_path, -1 , NULL , 0 );
1285+ return_size = MultiByteToWideChar (CP_ACP, 0 , real_path, -1 , nullptr , 0 );
12861286 if (0 == return_size)
12871287 {
12881288 ASSERT (" MultiByteToWideChar failure\n " );
1289- return NULL ;
1289+ return nullptr ;
12901290 }
12911291
12921292 return_value = reinterpret_cast <LPWSTR>(InternalMalloc ((return_size*sizeof (WCHAR))));
1293- if (NULL == return_value)
1293+ if (nullptr == return_value)
12941294 {
12951295 ERROR (" Not enough memory to create full path\n " );
1296- return NULL ;
1296+ return nullptr ;
12971297 }
12981298 else
12991299 {
@@ -1302,7 +1302,7 @@ static LPWSTR INIT_GetCurrentEXEPath()
13021302 {
13031303 ASSERT (" MultiByteToWideChar failure\n " );
13041304 free (return_value);
1305- return_value = NULL ;
1305+ return_value = nullptr ;
13061306 }
13071307 else
13081308 {
0 commit comments