From: Chris Bieneman Date: Fri, 29 Aug 2014 01:05:16 +0000 (+0000) Subject: Cleaning up static initializers in Signals.inc X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=d814e38de83e9a7ed4203cf4a7934f0716b08670 Cleaning up static initializers in Signals.inc Reviewed by: Chandlerc git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216704 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc index c820553665d..36e521b2531 100644 --- a/lib/Support/Unix/Signals.inc +++ b/lib/Support/Unix/Signals.inc @@ -56,7 +56,6 @@ static std::vector > CallBacksToRun; static const int IntSigs[] = { SIGHUP, SIGINT, SIGPIPE, SIGTERM, SIGUSR1, SIGUSR2 }; -static const int *const IntSigsEnd = std::end(IntSigs); // KillSigs - Signals that represent that we have a bug, and our prompt // termination has been ordered. @@ -75,7 +74,6 @@ static const int KillSigs[] = { , SIGEMT #endif }; -static const int *const KillSigsEnd = std::end(KillSigs); static unsigned NumRegisteredSignals = 0; static struct { @@ -106,8 +104,8 @@ static void RegisterHandlers() { // If the handlers are already registered, we're done. if (NumRegisteredSignals != 0) return; - std::for_each(IntSigs, IntSigsEnd, RegisterHandler); - std::for_each(KillSigs, KillSigsEnd, RegisterHandler); + for (auto S : IntSigs) RegisterHandler(S); + for (auto S : KillSigs) RegisterHandler(S); } static void UnregisterHandlers() { @@ -167,7 +165,8 @@ static RETSIGTYPE SignalHandler(int Sig) { unique_lock> Guard(SignalsMutex); RemoveFilesToRemove(); - if (std::find(IntSigs, IntSigsEnd, Sig) != IntSigsEnd) { + if (std::find(std::begin(IntSigs), std::end(IntSigs), Sig) + != std::end(IntSigs)) { if (InterruptFunction) { void (*IF)() = InterruptFunction; Guard.unlock();