Skip to content

Commit

Permalink
Fix 'limit, base can be declared as pointer to const' cppcheck warnings
Browse files Browse the repository at this point in the history
(fix of commit e37ab2a)

Issue #627 (bdwgc).

* allchblk.c (drop_hblk_in_chunks): Declare limit local variable as
a const pointer.
* mark.c [ENABLE_TRACE] (GC_mark_from): Declare base local variable as
a const pointer.
  • Loading branch information
ivmai committed Apr 15, 2024
1 parent 4859275 commit 8ce0db8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion allchblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ static struct hblk *find_nonbl_hblk(struct hblk *last_hbp, word size_remain,
static void drop_hblk_in_chunks(int n, struct hblk *hbp, hdr *hhdr)
{
size_t total_size = (size_t)(hhdr -> hb_sz);
struct hblk *limit = hbp + divHBLKSZ(total_size);
const struct hblk *limit = hbp + divHBLKSZ(total_size);

GC_ASSERT(HDR(hbp) == hhdr);
GC_ASSERT(modHBLKSZ(total_size) == 0 && total_size > 0);
Expand Down
2 changes: 1 addition & 1 deletion mark.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ GC_INNER mse * GC_mark_from(mse *mark_stack_top, mse *mark_stack,
mark_stack_top--;
# ifdef ENABLE_TRACE
if (ADDR_GE(GC_trace_addr, current_p)) {
void *base = GC_base(current_p);
const void *base = GC_base(current_p);

if (base != NULL && GC_base(GC_trace_addr) == base) {
GC_log_printf("GC #%lu: tracing from %p, proc descr %lu\n",
Expand Down

0 comments on commit 8ce0db8

Please sign in to comment.