summaryrefslogtreecommitdiff
path: root/finalize.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2016-10-28 11:29:22 +0300
committerIvan Maidanski <ivmai@mail.ru>2016-10-28 11:29:22 +0300
commit9a88601c08f0943d7d087f85e4d77263a2162bbd (patch)
tree7ddff02a2ae59993f6a5fb2ef6a8ac3716418d74 /finalize.c
parent4918afb25a2ee683036ef2c0aba005c4edef89da (diff)
downloadbdwgc-9a88601c08f0943d7d087f85e4d77263a2162bbd.tar.gz
Eliminate redundant local variable in register_finalizer
The variable caused a report about a code defect which is a false positive. * finalize.c (GC_register_finalizer_inner): Remove "base" local variable (use "obj" argument instead).
Diffstat (limited to 'finalize.c')
-rw-r--r--finalize.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/finalize.c b/finalize.c
index 19e6fbec..dc03d22d 100644
--- a/finalize.c
+++ b/finalize.c
@@ -631,7 +631,6 @@ STATIC void GC_register_finalizer_inner(void * obj,
GC_finalization_proc *ofn, void **ocd,
finalization_mark_proc mp)
{
- ptr_t base;
struct finalizable_object * curr_fo;
size_t index;
struct finalizable_object *new_fo = 0;
@@ -647,22 +646,21 @@ STATIC void GC_register_finalizer_inner(void * obj,
1 << (unsigned)log_fo_table_size);
}
/* in the THREADS case we hold allocation lock. */
- base = (ptr_t)obj;
for (;;) {
struct finalizable_object *prev_fo = NULL;
GC_oom_func oom_fn;
- index = HASH2(base, log_fo_table_size);
+ index = HASH2(obj, log_fo_table_size);
curr_fo = GC_fnlz_roots.fo_head[index];
while (curr_fo != 0) {
GC_ASSERT(GC_size(curr_fo) >= sizeof(struct finalizable_object));
- if (curr_fo -> fo_hidden_base == GC_HIDE_POINTER(base)) {
+ if (curr_fo -> fo_hidden_base == GC_HIDE_POINTER(obj)) {
/* Interruption by a signal in the middle of this */
/* should be safe. The client may see only *ocd */
/* updated, but we'll declare that to be his problem. */
if (ocd) *ocd = (void *) (curr_fo -> fo_client_data);
if (ofn) *ofn = curr_fo -> fo_fn;
- /* Delete the structure for base. */
+ /* Delete the structure for obj. */
if (prev_fo == 0) {
GC_fnlz_roots.fo_head[index] = fo_next(curr_fo);
} else {
@@ -711,7 +709,7 @@ STATIC void GC_register_finalizer_inner(void * obj,
UNLOCK();
return;
}
- GET_HDR(base, hhdr);
+ GET_HDR(obj, hhdr);
if (EXPECT(0 == hhdr, FALSE)) {
/* We won't collect it, hence finalizer wouldn't be run. */
if (ocd) *ocd = 0;
@@ -739,7 +737,7 @@ STATIC void GC_register_finalizer_inner(void * obj,
GC_ASSERT(GC_size(new_fo) >= sizeof(struct finalizable_object));
if (ocd) *ocd = 0;
if (ofn) *ofn = 0;
- new_fo -> fo_hidden_base = GC_HIDE_POINTER(base);
+ new_fo -> fo_hidden_base = GC_HIDE_POINTER(obj);
new_fo -> fo_fn = fn;
new_fo -> fo_client_data = (ptr_t)cd;
new_fo -> fo_object_size = hhdr -> hb_sz;