The big NULL replacement party part 6.

...and ', NULL' had even more to replace.
This commit is contained in:
Jason Felds
2013-05-03 23:49:23 -04:00
parent 28e5148dec
commit 07b9fb6da5
95 changed files with 2582 additions and 2582 deletions
+2 -2
View File
@@ -42,7 +42,7 @@ void BacktraceNames::Demangle()
return;
int status = 0;
char *name = abi::__cxa_demangle( Symbol, NULL, NULL, &status );
char *name = abi::__cxa_demangle( Symbol, nullptr, nullptr, &status );
if( name )
{
Symbol = name;
@@ -375,7 +375,7 @@ void BacktraceNames::FromAddr( const void *p )
char *p;
asprintf(&p, "%d", ppid);
execl("/usr/bin/atos", "/usr/bin/atos", "-p", p, addy, NULL);
execl("/usr/bin/atos", "/usr/bin/atos", "-p", p, addy, nullptr);
fprintf(stderr, "execl(atos) failed: %s\n", strerror(errno));
free(addy);
+19 -19
View File
@@ -80,13 +80,13 @@ static void NORETURN spawn_child_process( int from_parent )
strncpy( magic, CHILD_MAGIC_PARAMETER, sizeof(magic) );
/* Use execve; it's the lowest-level of the exec calls. The others may allocate. */
char *argv[3] = { path, magic, NULL };
char *argv[3] = { path, magic, nullptr };
char *envp[1] = { NULL };
execve( path, argv, envp );
/* If we got here, the exec failed. We can't call strerror. */
// safe_print(fileno(stderr), "Crash handler execl(", path, ") failed: ", strerror(errno), "\n", NULL);
safe_print( fileno(stderr), "Crash handler execl(", path, ") failed: ", itoa( errno ), "\n", NULL );
// safe_print(fileno(stderr), "Crash handler execl(", path, ") failed: ", strerror(errno), "\n", nullptr);
safe_print( fileno(stderr), "Crash handler execl(", path, ") failed: ", itoa( errno ), "\n", nullptr );
_exit(1);
}
@@ -108,13 +108,13 @@ static bool parent_write( int to_child, const void *p, size_t size )
int ret = retried_write( to_child, p, size );
if( ret == -1 )
{
safe_print( fileno(stderr), "Unexpected write() result (", strerror(errno), ")\n", NULL );
safe_print( fileno(stderr), "Unexpected write() result (", strerror(errno), ")\n", nullptr );
return false;
}
if( size_t(ret) != size )
{
safe_print( fileno(stderr), "Unexpected write() result (", itoa(ret), ")\n", NULL );
safe_print( fileno(stderr), "Unexpected write() result (", itoa(ret), ")\n", nullptr );
return false;
}
@@ -205,7 +205,7 @@ static void RunCrashHandler( const CrashData *crash )
{
if( g_pCrashHandlerArgv0 == nullptr )
{
safe_print( fileno(stderr), "Crash handler failed: CrashHandlerHandleArgs was not called\n", NULL );
safe_print( fileno(stderr), "Crash handler failed: CrashHandlerHandleArgs was not called\n", nullptr );
_exit( 1 );
}
@@ -213,9 +213,9 @@ static void RunCrashHandler( const CrashData *crash )
struct sigaction sa;
memset( &sa, 0, sizeof(sa) );
sa.sa_handler = SIG_IGN;
if( sigaction( SIGPIPE, &sa, NULL ) != 0 )
if( sigaction( SIGPIPE, &sa, nullptr ) != 0 )
{
safe_print( fileno(stderr), "sigaction() failed: %s", strerror(errno), NULL );
safe_print( fileno(stderr), "sigaction() failed: %s", strerror(errno), nullptr );
/* non-fatal */
}
@@ -229,22 +229,22 @@ static void RunCrashHandler( const CrashData *crash )
switch( crash->type )
{
case CrashData::SIGNAL:
safe_print( fileno(stderr), "Fatal signal (", SignalName(crash->signal), ")", NULL );
safe_print( fileno(stderr), "Fatal signal (", SignalName(crash->signal), ")", nullptr );
break;
case CrashData::FORCE_CRASH:
safe_print( fileno(stderr), "Crash handler failed: \"", crash->reason, "\"", NULL );
safe_print( fileno(stderr), "Crash handler failed: \"", crash->reason, "\"", nullptr );
break;
default:
safe_print( fileno(stderr), "Unexpected RunCrashHandler call (", itoa(crash->type), ")", NULL );
safe_print( fileno(stderr), "Unexpected RunCrashHandler call (", itoa(crash->type), ")", nullptr );
break;
}
if( active == 1 )
safe_print( fileno(stderr), " while still in the crash handler\n", NULL);
safe_print( fileno(stderr), " while still in the crash handler\n", nullptr);
else if( active == 2 )
safe_print( fileno(stderr), " while in the crash handler child\n", NULL);
safe_print( fileno(stderr), " while in the crash handler child\n", nullptr);
_exit( 1 );
}
@@ -259,14 +259,14 @@ static void RunCrashHandler( const CrashData *crash )
int fds[2];
if( pipe(fds) != 0 )
{
safe_print( fileno(stderr), "Crash handler pipe() failed: ", strerror(errno), "\n", NULL );
safe_print( fileno(stderr), "Crash handler pipe() failed: ", strerror(errno), "\n", nullptr );
exit( 1 );
}
pid_t childpid = fork();
if( childpid == -1 )
{
safe_print( fileno(stderr), "Crash handler fork() failed: ", strerror(errno), "\n", NULL );
safe_print( fileno(stderr), "Crash handler fork() failed: ", strerror(errno), "\n", nullptr );
_exit( 1 );
}
@@ -297,7 +297,7 @@ static void RunCrashHandler( const CrashData *crash )
RageThread::ResumeAllThreads();
if( WIFSIGNALED(status) )
safe_print( fileno(stderr), "Crash handler child exited with signal ", itoa(WTERMSIG(status)), "\n", NULL );
safe_print( fileno(stderr), "Crash handler child exited with signal ", itoa(WTERMSIG(status)), "\n", nullptr );
}
}
@@ -332,7 +332,7 @@ void CrashHandler::ForceCrash( const char *reason )
strncpy( crash.reason, reason, sizeof(crash.reason) );
crash.reason[ sizeof(crash.reason)-1 ] = 0;
GetBacktrace( crash.BacktracePointers[0], BACKTRACE_MAX_SIZE, NULL );
GetBacktrace( crash.BacktracePointers[0], BACKTRACE_MAX_SIZE, nullptr );
RunCrashHandler( &crash );
}
@@ -344,7 +344,7 @@ void CrashHandler::ForceDeadlock( RString reason, uint64_t iID )
crash.type = CrashData::FORCE_CRASH;
GetBacktrace( crash.BacktracePointers[0], BACKTRACE_MAX_SIZE, NULL );
GetBacktrace( crash.BacktracePointers[0], BACKTRACE_MAX_SIZE, nullptr );
if( iID == GetInvalidThreadId() )
{
@@ -376,7 +376,7 @@ void CrashHandler::CrashSignalHandler( int signal, siginfo_t *si, const ucontext
static volatile bool bInCrashSignalHandler = false;
if( bInCrashSignalHandler )
{
safe_print( 2, "Fatal: crash from within the crash signal handler\n", NULL );
safe_print( 2, "Fatal: crash from within the crash signal handler\n", nullptr );
_exit(1);
}
+1 -1
View File
@@ -157,7 +157,7 @@ static void child_process()
FD_ZERO( &rs );
FD_SET( 3, &rs );
int ret = select( 4, &rs, NULL, NULL, &timeout );
int ret = select( 4, &rs, nullptr, nullptr, &timeout );
if( ret == 0 )
{
+3 -3
View File
@@ -94,7 +94,7 @@ static int waittid( int ThreadID, int *status, int options )
static int PtraceAttach( int ThreadID )
{
int ret;
ret = ptrace( PTRACE_ATTACH, ThreadID, NULL, NULL );
ret = ptrace( PTRACE_ATTACH, ThreadID, nullptr, nullptr );
if( ret == -1 )
{
printf("ptrace failed: %s\n", strerror(errno) );
@@ -114,7 +114,7 @@ static int PtraceAttach( int ThreadID )
static int PtraceDetach( int ThreadID )
{
return ptrace( PTRACE_DETACH, ThreadID, NULL, NULL );
return ptrace( PTRACE_DETACH, ThreadID, nullptr, nullptr );
}
@@ -217,7 +217,7 @@ bool GetThreadBacktraceContext( uint64_t ThreadID, BacktraceContext *ctx )
#if defined(CPU_X86_64) || defined(CPU_X86)
user_regs_struct regs;
if( ptrace( PTRACE_GETREGS, pid_t(ThreadID), NULL, &regs ) == -1 )
if( ptrace( PTRACE_GETREGS, pid_t(ThreadID), nullptr, &regs ) == -1 )
return false;
ctx->pid = pid_t(ThreadID);
+6 -6
View File
@@ -57,7 +57,7 @@ SaveSignals::SaveSignals()
for( int i = 0; signals[i] != -1; ++i )
{
struct sigaction sa;
sigaction( signals[i], NULL, &sa );
sigaction( signals[i], nullptr, &sa );
old_handlers.push_back( sa );
}
}
@@ -66,7 +66,7 @@ SaveSignals::~SaveSignals()
{
/* Restore the old signal handlers. */
for( unsigned i = 0; i < old_handlers.size(); ++i )
sigaction( signals[i], &old_handlers[i], NULL );
sigaction( signals[i], &old_handlers[i], nullptr );
}
static void SigHandler( int signal, siginfo_t *si, void *ucp )
@@ -86,7 +86,7 @@ static void SigHandler( int signal, siginfo_t *si, void *ucp )
struct sigaction old;
sigaction( signal, &sa, &old );
raise( signal );
sigaction( signal, &old, NULL );
sigaction( signal, &old, nullptr );
}
}
@@ -166,7 +166,7 @@ void SignalHandler::OnClose( handler h )
ss.ss_sp = (char*)p; /* cast for Darwin */
ss.ss_size = AltStackSize;
ss.ss_flags = 0;
if( sigaltstack( &ss, NULL ) == -1 )
if( sigaltstack( &ss, nullptr ) == -1 )
{
LOG->Info( "sigaltstack failed: %s", strerror(errno) );
p = nullptr; /* no SA_ONSTACK */
@@ -185,11 +185,11 @@ void SignalHandler::OnClose( handler h )
/* Set up our signal handlers. */
sa.sa_sigaction = SigHandler;
for( int i = 0; signals[i] != -1; ++i )
sigaction( signals[i], &sa, NULL );
sigaction( signals[i], &sa, nullptr );
/* Block SIGPIPE, so we get EPIPE. */
sa.sa_handler = SIG_IGN;
sigaction( SIGPIPE, &sa, NULL );
sigaction( SIGPIPE, &sa, nullptr );
}
handlers.push_back(h);
}