aboutsummaryrefslogtreecommitdiffstats
path: root/lib/System/Unix/Signals.inc
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-09-07 04:06:50 +0000
committerOwen Anderson <resistor@mac.com>2007-09-07 04:06:50 +0000
commit1636de94069d492185da2dd36859d4a1962a2eed (patch)
tree51ddca6b6eead9bf38aafd5507e6c3c06048f0ad /lib/System/Unix/Signals.inc
parente97f07714219e0407f908428c157ba7ec0cbf2dd (diff)
downloadexternal_llvm-1636de94069d492185da2dd36859d4a1962a2eed.zip
external_llvm-1636de94069d492185da2dd36859d4a1962a2eed.tar.gz
external_llvm-1636de94069d492185da2dd36859d4a1962a2eed.tar.bz2
Add lengthof and endof templates that hide a lot of sizeof computations.
Patch by Sterling Stein! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41758 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix/Signals.inc')
-rw-r--r--lib/System/Unix/Signals.inc7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/System/Unix/Signals.inc b/lib/System/Unix/Signals.inc
index d1493a2..b790e05 100644
--- a/lib/System/Unix/Signals.inc
+++ b/lib/System/Unix/Signals.inc
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "Unix.h"
+#include "llvm/ADT/STLExtras.h"
#include <vector>
#include <algorithm>
#if HAVE_EXECINFO_H
@@ -40,7 +41,7 @@ std::vector<sys::Path> *DirectoriesToRemove = 0;
const int IntSigs[] = {
SIGHUP, SIGINT, SIGQUIT, SIGPIPE, SIGTERM, SIGUSR1, SIGUSR2
};
-const int *IntSigsEnd = IntSigs + sizeof(IntSigs)/sizeof(IntSigs[0]);
+const int *IntSigsEnd = array_endof(IntSigs);
// KillSigs - Signals that are synchronous with the program that will cause it
// to die.
@@ -50,7 +51,7 @@ const int KillSigs[] = {
, SIGEMT
#endif
};
-const int *KillSigsEnd = KillSigs + sizeof(KillSigs)/sizeof(KillSigs[0]);
+const int *KillSigsEnd = array_endof(KillSigs);
#ifdef HAVE_BACKTRACE
void* StackTrace[256];
@@ -68,7 +69,7 @@ void* StackTrace[256];
void PrintStackTrace() {
#ifdef HAVE_BACKTRACE
// Use backtrace() to output a backtrace on Linux systems with glibc.
- int depth = backtrace(StackTrace, sizeof(StackTrace)/sizeof(StackTrace[0]));
+ int depth = backtrace(StackTrace, array_lengthof(StackTrace));
// Create a one-way unix pipe. The backtracing process writes to PipeFDs[1],
// the c++filt process reads from PipeFDs[0].