Issue #236: Add -Wcast-qual and fix casts to retain constness.

To better distinguish between entry->k and entry->v being const within linkhash, but non-const outside, add lh_entry_v() and lh_entry_k() accessors.
Make lh_entry->k const.
This commit is contained in:
Eric Haszlakiewicz
2016-06-11 18:18:46 +00:00
parent f285c0a2e5
commit 595891729e
7 changed files with 61 additions and 33 deletions

View File

@@ -105,7 +105,7 @@ json_object_iter_next(struct json_object_iterator* iter)
JASSERT(NULL != iter);
JASSERT(kObjectEndIterValue != iter->opaque_);
iter->opaque_ = ((struct lh_entry *)iter->opaque_)->next;
iter->opaque_ = ((const struct lh_entry *)iter->opaque_)->next;
}
@@ -118,7 +118,7 @@ json_object_iter_peek_name(const struct json_object_iterator* iter)
JASSERT(NULL != iter);
JASSERT(kObjectEndIterValue != iter->opaque_);
return (const char*)(((struct lh_entry *)iter->opaque_)->k);
return (const char*)(((const struct lh_entry *)iter->opaque_)->k);
}
@@ -131,7 +131,7 @@ json_object_iter_peek_value(const struct json_object_iterator* iter)
JASSERT(NULL != iter);
JASSERT(kObjectEndIterValue != iter->opaque_);
return (struct json_object*)(((struct lh_entry *)iter->opaque_)->v);
return (struct json_object*)lh_entry_v((const struct lh_entry *)iter->opaque_);
}