diff options
author | Eric Haszlakiewicz <erh+git@nimenees.com> | 2016-06-11 18:18:46 +0000 |
---|---|---|
committer | Eric Haszlakiewicz <erh+git@nimenees.com> | 2016-06-11 18:19:39 +0000 |
commit | 595891729ecf39eac42536e12024435f5d8ea8fe (patch) | |
tree | 219876f6dfb7e906eff857e63fc9ce25a5084da6 /json_object_iterator.c | |
parent | f285c0a2e50ffa1b9d81aa9204324525542e43f8 (diff) | |
download | json-c-595891729ecf39eac42536e12024435f5d8ea8fe.tar.gz |
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.
Diffstat (limited to 'json_object_iterator.c')
-rw-r--r-- | json_object_iterator.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/json_object_iterator.c b/json_object_iterator.c index 7066649..7c2a25b 100644 --- a/json_object_iterator.c +++ b/json_object_iterator.c @@ -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_); } |