1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-25 00:27:39 +01:00

Prefer NULL over zero

This commit is contained in:
Tommi Rantala 2012-09-21 08:38:52 +03:00
parent aebba1f8a7
commit 890e23eb9d
10 changed files with 19 additions and 19 deletions

View file

@ -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)

View file

@ -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: */

View file

@ -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)

View file

@ -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);
}

View file

@ -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;
}
}

View file

@ -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;

View file

@ -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 */

View file

@ -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)

View file

@ -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)
{

View file

@ -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)