summaryrefslogtreecommitdiff
path: root/headers.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-11-07 23:34:04 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-11-07 23:34:04 +0300
commit93374170974aba0e9992c5acedb52d887f237a93 (patch)
tree35d345fc070dd3d5cbbc68b2dd60e886c7aad900 /headers.c
parent36a6d79e182861a70c53a604e36bb34a8bad7bd1 (diff)
downloadbdwgc-93374170974aba0e9992c5acedb52d887f237a93.tar.gz
Use GC_WORD_MAX macro across all C source files
(code refactoring) * alloc.c (GC_collect_at_heapsize, GC_compute_heap_usage_percent, GC_add_to_heap, GC_expand_hp_inner): Use GC_WORD_MAX instead of (word)-1. * dyn_load.c [DATASTART_IS_FUNC] (GC_register_dynamic_libraries_dl_iterate_phdr): Likewise. * finalize.c [KEEP_BACK_PTRS] (GC_notify_or_invoke_finalizers): Likewise. * headers.c (GC_install_counts): Likewise. * include/private/thread_local_alloc.h [GC_GCJ_SUPPORT] (ERROR_FL): Likewise. * os_dep.c [NEED_FIND_LIMIT || USE_PROC_FOR_LIBRARIES] (GC_find_limit): Likewise. * os_dep.c [MPROTECT_VDB && DARWIN] (GC_mprotect_thread): Likewise. * pthread_support.c [PARALLEL_MARK] (GC_mark_thread): Likewise. * win32_threads.c (ADDR_LIMIT): Likewise. * win32_threads.c [PARALLEL_MARK] (GC_mark_thread): Likewise. * alloc.c (GC_least_plausible_heap_addr): Use GC_WORD_MAX instead of ONES macro. * include/private/gc_priv.h [STACK_GROWS_DOWN] (MAKE_COOLER): Likewise. * mark.c (GC_set_hdr_marks): Likewise. * alloc.c (GC_WORD_MAX): Remove definition (in this file). * headers.c (GC_install_counts): Reformat code. * include/private/gc_priv.h (ONES): Rename to GC_WORD_MAX.
Diffstat (limited to 'headers.c')
-rw-r--r--headers.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/headers.c b/headers.c
index 462da89f..1b3b3ebb 100644
--- a/headers.c
+++ b/headers.c
@@ -283,17 +283,19 @@ GC_INNER GC_bool GC_install_counts(struct hblk *h, size_t sz/* bytes */)
struct hblk * hbp;
for (hbp = h; (word)hbp < (word)h + sz; hbp += BOTTOM_SZ) {
- if (!get_index((word) hbp)) return(FALSE);
- if ((word)hbp > (~(word)0) - (word)BOTTOM_SZ * HBLKSIZE)
+ if (!get_index((word)hbp))
+ return FALSE;
+ if ((word)hbp > GC_WORD_MAX - (word)BOTTOM_SZ * HBLKSIZE)
break; /* overflow of hbp+=BOTTOM_SZ is expected */
}
- if (!get_index((word)h + sz - 1)) return(FALSE);
+ if (!get_index((word)h + sz - 1))
+ return FALSE;
for (hbp = h + 1; (word)hbp < (word)h + sz; hbp += 1) {
word i = HBLK_PTR_DIFF(hbp, h);
SET_HDR(hbp, (hdr *)(i > MAX_JUMP? MAX_JUMP : i));
}
- return(TRUE);
+ return TRUE;
}
/* Remove the header for block h */