summaryrefslogtreecommitdiff
path: root/headers.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2016-10-04 23:27:53 +0300
committerIvan Maidanski <ivmai@mail.ru>2016-10-04 23:27:53 +0300
commit03bb5fb61138482085be2330c4da9491a081ec52 (patch)
tree35e44a0858e5532f68b7609ced2e3bc14f865558 /headers.c
parente248d685833a498e7dc0938bca47f08dfa611cd5 (diff)
downloadbdwgc-03bb5fb61138482085be2330c4da9491a081ec52.tar.gz
Eliminate more 'scope of variable can be reduced' cppcheck style warnings
* allchblk.c (GC_compute_large_free_bytes, GC_print_hblkfreelist, free_list_index_of, GC_dump_regions, GC_add_to_fl, GC_unmap_old, GC_allochblk_nth): Move local variable declaration to the inner scope where the variable is actually used. * alloc.c (GC_maybe_gc, GC_collect_a_little_inner, GC_set_fl_marks, GC_clear_fl_marks): Likewise. * dyn_load.c (GC_register_dynamic_libraries): Likewise. * finalize.c (GC_ignore_self_finalize_mark_proc, GC_register_finalizer_inner, GC_dump_finalization_links, GC_dump_finalization, GC_make_disappearing_links_disappear, GC_remove_dangling_disappearing_links, GC_invoke_finalizers): Likewise. * headers.c (GC_install_counts): Likewise. * malloc.c (GC_malloc_kind_global, GC_generic_malloc_uncollectable, GC_free): Likewise. * mark.c (GC_push_all_eager, GC_push_marked1, GC_push_marked2, GC_push_marked4): Likewise. * mark_rts.c (GC_next_exclusion, GC_exclude_static_roots_inner, GC_push_conditional_with_exclusions): Likewise. * misc.c (GC_base, GC_parse_mem_size_arg, GC_write): Likewise. * os_dep.c (GC_repeat_read, GC_get_maps, GC_least_described_address, GC_register_root_section, GC_register_data_segments): Likewise. * reclaim.c (GC_reclaim_block, GC_start_reclaim): Likewise. * finalize.c (ITERATE_DL_HASHTBL_BEGIN): Declare prev_dl local variable.
Diffstat (limited to 'headers.c')
-rw-r--r--headers.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/headers.c b/headers.c
index c8f7f640..c145e4a7 100644
--- a/headers.c
+++ b/headers.c
@@ -277,14 +277,14 @@ GC_INNER struct hblkhdr * GC_install_header(struct hblk *h)
GC_INNER GC_bool GC_install_counts(struct hblk *h, size_t sz/* bytes */)
{
struct hblk * hbp;
- word i;
for (hbp = h; (word)hbp < (word)h + sz; hbp += BOTTOM_SZ) {
if (!get_index((word) hbp)) return(FALSE);
}
if (!get_index((word)h + sz - 1)) return(FALSE);
for (hbp = h + 1; (word)hbp < (word)h + sz; hbp += 1) {
- i = HBLK_PTR_DIFF(hbp, h);
+ word i = HBLK_PTR_DIFF(hbp, h);
+
SET_HDR(hbp, (hdr *)(i > MAX_JUMP? MAX_JUMP : i));
}
return(TRUE);