summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTommi Rantala <tt.rantala@gmail.com>2012-09-21 08:38:52 +0300
committerTommi Rantala <tt.rantala@gmail.com>2012-09-28 14:51:21 +0300
commit890e23eb9d3ffd9be2a025189a21794b5ed0e0ff (patch)
tree468d1a9368daa448a86fd85a49ae505168bc943a
parentaebba1f8a7dee9b9ae3e70128ad48de69ca90b15 (diff)
downloadlibunwind-890e23eb9d3ffd9be2a025189a21794b5ed0e0ff.tar.gz
Prefer NULL over zero
-rw-r--r--include/libunwind_i.h10
-rw-r--r--src/dwarf/Gfind_proc_info-lsb.c2
-rw-r--r--src/dwarf/Gparser.c6
-rw-r--r--src/mips/Ginit.c2
-rw-r--r--src/os-linux.h4
-rw-r--r--src/x86_64/Ginit.c2
-rw-r--r--src/x86_64/Ginit_remote.c2
-rw-r--r--src/x86_64/Gtrace.c6
-rw-r--r--tests/mapper.c2
-rw-r--r--tests/test-ptrace.c2
10 files changed, 19 insertions, 19 deletions
diff --git a/include/libunwind_i.h b/include/libunwind_i.h
index e0fb64b4..23f615e0 100644
--- a/include/libunwind_i.h
+++ b/include/libunwind_i.h
@@ -88,11 +88,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#pragma weak pthread_mutex_unlock
#define mutex_init(l) \
- (pthread_mutex_init != 0 ? pthread_mutex_init ((l), 0) : 0)
+ (pthread_mutex_init != NULL ? pthread_mutex_init ((l), NULL) : 0)
#define mutex_lock(l) \
- (pthread_mutex_lock != 0 ? pthread_mutex_lock (l) : 0)
+ (pthread_mutex_lock != NULL ? pthread_mutex_lock (l) : 0)
#define mutex_unlock(l) \
- (pthread_mutex_unlock != 0 ? pthread_mutex_unlock (l) : 0)
+ (pthread_mutex_unlock != NULL ? pthread_mutex_unlock (l) : 0)
#ifdef HAVE_ATOMIC_OPS_H
# include <atomic_ops.h>
@@ -187,8 +187,8 @@ do { \
#define GET_MEMORY(mem, size) \
do { \
/* Hopefully, mmap() goes straight through to a system call stub... */ \
- mem = mmap (0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, \
- -1, 0); \
+ mem = mmap (NULL, size, PROT_READ | PROT_WRITE, \
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \
if (mem == MAP_FAILED) \
mem = NULL; \
} while (0)
diff --git a/src/dwarf/Gfind_proc_info-lsb.c b/src/dwarf/Gfind_proc_info-lsb.c
index ae0b9396..975c9692 100644
--- a/src/dwarf/Gfind_proc_info-lsb.c
+++ b/src/dwarf/Gfind_proc_info-lsb.c
@@ -757,7 +757,7 @@ static inline const struct table_entry *
lookup (const struct table_entry *table, size_t table_size, int32_t rel_ip)
{
unsigned long table_len = table_size / sizeof (struct table_entry);
- const struct table_entry *e = 0;
+ const struct table_entry *e = NULL;
unsigned long lo, hi, mid;
/* do a binary search for right entry: */
diff --git a/src/dwarf/Gparser.c b/src/dwarf/Gparser.c
index fd2bdae2..49c79db1 100644
--- a/src/dwarf/Gparser.c
+++ b/src/dwarf/Gparser.c
@@ -582,7 +582,7 @@ rs_lookup (struct dwarf_rs_cache *cache, struct dwarf_cursor *c)
index = cache->hash[hash (ip)];
if (index >= DWARF_UNW_CACHE_SIZE)
- return 0;
+ return NULL;
rs = cache->buckets + index;
while (1)
@@ -595,7 +595,7 @@ rs_lookup (struct dwarf_rs_cache *cache, struct dwarf_cursor *c)
return rs;
}
if (rs->coll_chain >= DWARF_UNW_HASH_SIZE)
- return 0;
+ return NULL;
rs = cache->buckets + rs->coll_chain;
}
}
@@ -620,7 +620,7 @@ rs_new (struct dwarf_rs_cache *cache, struct dwarf_cursor * c)
{
index = hash (rs->ip);
tmp = cache->buckets + cache->hash[index];
- prev = 0;
+ prev = NULL;
while (1)
{
if (tmp == rs)
diff --git a/src/mips/Ginit.c b/src/mips/Ginit.c
index 31000b3c..dc9c1250 100644
--- a/src/mips/Ginit.c
+++ b/src/mips/Ginit.c
@@ -202,7 +202,7 @@ mips_local_addr_space_init (void)
local_addr_space.acc.access_mem = access_mem;
local_addr_space.acc.access_reg = access_reg;
local_addr_space.acc.access_fpreg = access_fpreg;
- local_addr_space.acc.resume = 0; /* mips_local_resume? FIXME! */
+ local_addr_space.acc.resume = NULL; /* mips_local_resume? FIXME! */
local_addr_space.acc.get_proc_name = get_static_proc_name;
unw_flush_cache (&local_addr_space, 0, 0);
}
diff --git a/src/os-linux.h b/src/os-linux.h
index 5b7295b0..ad9d675e 100644
--- a/src/os-linux.h
+++ b/src/os-linux.h
@@ -77,7 +77,7 @@ maps_init (struct map_iterator *mi, pid_t pid)
{
/* Try to allocate a page-sized buffer. */
mi->buf_size = getpagesize ();
- cp = mmap (0, mi->buf_size, PROT_READ | PROT_WRITE,
+ cp = mmap (NULL, mi->buf_size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (cp == MAP_FAILED)
{
@@ -290,7 +290,7 @@ maps_close (struct map_iterator *mi)
if (mi->buf)
{
munmap (mi->buf_end - mi->buf_size, mi->buf_size);
- mi->buf = mi->buf_end = 0;
+ mi->buf = mi->buf_end = NULL;
}
}
diff --git a/src/x86_64/Ginit.c b/src/x86_64/Ginit.c
index ee62d02e..daea0780 100644
--- a/src/x86_64/Ginit.c
+++ b/src/x86_64/Ginit.c
@@ -167,7 +167,7 @@ access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
{
/* validate address */
const struct cursor *c = (const struct cursor *)arg;
- if (likely (c != 0) && unlikely (c->validate)
+ if (likely (c != NULL) && unlikely (c->validate)
&& unlikely (validate_mem (addr)))
return -1;
*val = *(unw_word_t *) addr;
diff --git a/src/x86_64/Ginit_remote.c b/src/x86_64/Ginit_remote.c
index 1b7123c0..4fd2092e 100644
--- a/src/x86_64/Ginit_remote.c
+++ b/src/x86_64/Ginit_remote.c
@@ -50,7 +50,7 @@ unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg)
else
{
c->dwarf.as_arg = as_arg;
- c->uc = 0;
+ c->uc = NULL;
}
return common_init (c, 0);
#endif /* !UNW_LOCAL_ONLY */
diff --git a/src/x86_64/Gtrace.c b/src/x86_64/Gtrace.c
index 89453a88..9a86a06c 100644
--- a/src/x86_64/Gtrace.c
+++ b/src/x86_64/Gtrace.c
@@ -89,7 +89,7 @@ trace_cache_buckets (size_t n)
size_t i;
GET_MEMORY(frames, n * sizeof (unw_tdep_frame_t));
- if (likely(frames != 0))
+ if (likely(frames != NULL))
for (i = 0; i < n; ++i)
frames[i] = empty_frame;
@@ -162,7 +162,7 @@ trace_cache_get_unthreaded (void)
{
unw_trace_cache_t *cache;
intrmask_t saved_mask;
- static unw_trace_cache_t *global_cache = 0;
+ static unw_trace_cache_t *global_cache = NULL;
lock_acquire (&trace_init_lock, saved_mask);
if (! global_cache)
{
@@ -180,7 +180,7 @@ static unw_trace_cache_t *
trace_cache_get (void)
{
unw_trace_cache_t *cache;
- if (likely (pthread_once != 0))
+ if (likely (pthread_once != NULL))
{
pthread_once(&trace_cache_once, &trace_cache_init_once);
if (!trace_cache_once_happen)
diff --git a/tests/mapper.c b/tests/mapper.c
index e84697bf..905f3193 100644
--- a/tests/mapper.c
+++ b/tests/mapper.c
@@ -51,7 +51,7 @@ main (void)
printf ("Starting mmap test...\n");
for (n = 0; n < 30000; ++n)
{
- if (mmap (0, 1, (n & 1) ? PROT_READ : PROT_WRITE,
+ if (mmap (NULL, 1, (n & 1) ? PROT_READ : PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE,
-1, 0) == MAP_FAILED)
{
diff --git a/tests/test-ptrace.c b/tests/test-ptrace.c
index 69e18080..942b0db4 100644
--- a/tests/test-ptrace.c
+++ b/tests/test-ptrace.c
@@ -237,7 +237,7 @@ main (int argc, char **argv)
while (nerrors <= nerrors_max)
{
- pid = wait4 (-1, &status, 0, 0);
+ pid = wait4 (-1, &status, 0, NULL);
if (pid == -1)
{
if (errno == EINTR)