summaryrefslogtreecommitdiff
path: root/json_object_iterator.c
diff options
context:
space:
mode:
authordota17 <chenguopingdota@163.com>2020-03-28 10:25:00 +0800
committerdota17 <chenguopingdota@163.com>2020-04-03 11:39:30 +0800
commit8b162c4b896e5b40feb587aedb7c4f687d14dc67 (patch)
tree1404f3ba6994caf33f5147c793307c2569ca3226 /json_object_iterator.c
parentc117d8a8a83d5bcdd433b05e1846ccb73eb3413d (diff)
downloadjson-c-8b162c4b896e5b40feb587aedb7c4f687d14dc67.tar.gz
clang-format the files
Diffstat (limited to 'json_object_iterator.c')
-rw-r--r--json_object_iterator.c95
1 files changed, 42 insertions, 53 deletions
diff --git a/json_object_iterator.c b/json_object_iterator.c
index b5d9a55..796015e 100644
--- a/json_object_iterator.c
+++ b/json_object_iterator.c
@@ -53,111 +53,100 @@
/// Our current representation of the "end" iterator;
///
/// @note May not always be NULL
-static const void* kObjectEndIterValue = NULL;
+static const void *kObjectEndIterValue = NULL;
/**
* ****************************************************************************
*/
-struct json_object_iterator
-json_object_iter_begin(struct json_object* obj)
+struct json_object_iterator json_object_iter_begin(struct json_object *obj)
{
- struct json_object_iterator iter;
- struct lh_table* pTable;
-
- /// @note json_object_get_object will return NULL if passed NULL
- /// or a non-json_type_object instance
- pTable = json_object_get_object(obj);
- JASSERT(NULL != pTable);
-
- /// @note For a pair-less Object, head is NULL, which matches our
- /// definition of the "end" iterator
- iter.opaque_ = pTable->head;
- return iter;
+ struct json_object_iterator iter;
+ struct lh_table *pTable;
+
+ /// @note json_object_get_object will return NULL if passed NULL
+ /// or a non-json_type_object instance
+ pTable = json_object_get_object(obj);
+ JASSERT(NULL != pTable);
+
+ /// @note For a pair-less Object, head is NULL, which matches our
+ /// definition of the "end" iterator
+ iter.opaque_ = pTable->head;
+ return iter;
}
/**
* ****************************************************************************
*/
-struct json_object_iterator
-json_object_iter_end(const struct json_object* obj)
+struct json_object_iterator json_object_iter_end(const struct json_object *obj)
{
- struct json_object_iterator iter;
+ struct json_object_iterator iter;
- JASSERT(NULL != obj);
- JASSERT(json_object_is_type(obj, json_type_object));
+ JASSERT(NULL != obj);
+ JASSERT(json_object_is_type(obj, json_type_object));
- iter.opaque_ = kObjectEndIterValue;
+ iter.opaque_ = kObjectEndIterValue;
- return iter;
+ return iter;
}
/**
* ****************************************************************************
*/
-void
-json_object_iter_next(struct json_object_iterator* iter)
+void json_object_iter_next(struct json_object_iterator *iter)
{
- JASSERT(NULL != iter);
- JASSERT(kObjectEndIterValue != iter->opaque_);
+ JASSERT(NULL != iter);
+ JASSERT(kObjectEndIterValue != iter->opaque_);
- iter->opaque_ = ((const struct lh_entry *)iter->opaque_)->next;
+ iter->opaque_ = ((const struct lh_entry *)iter->opaque_)->next;
}
-
/**
* ****************************************************************************
*/
-const char*
-json_object_iter_peek_name(const struct json_object_iterator* iter)
+const char *json_object_iter_peek_name(const struct json_object_iterator *iter)
{
- JASSERT(NULL != iter);
- JASSERT(kObjectEndIterValue != iter->opaque_);
+ JASSERT(NULL != iter);
+ JASSERT(kObjectEndIterValue != iter->opaque_);
- return (const char*)(((const struct lh_entry *)iter->opaque_)->k);
+ return (const char *)(((const struct lh_entry *)iter->opaque_)->k);
}
-
/**
* ****************************************************************************
*/
-struct json_object*
-json_object_iter_peek_value(const struct json_object_iterator* iter)
+struct json_object *json_object_iter_peek_value(const struct json_object_iterator *iter)
{
- JASSERT(NULL != iter);
- JASSERT(kObjectEndIterValue != iter->opaque_);
+ JASSERT(NULL != iter);
+ JASSERT(kObjectEndIterValue != iter->opaque_);
- return (struct json_object*)lh_entry_v((const struct lh_entry *)iter->opaque_);
+ return (struct json_object *)lh_entry_v((const struct lh_entry *)iter->opaque_);
}
-
/**
* ****************************************************************************
*/
-json_bool
-json_object_iter_equal(const struct json_object_iterator* iter1,
- const struct json_object_iterator* iter2)
+json_bool json_object_iter_equal(const struct json_object_iterator *iter1,
+ const struct json_object_iterator *iter2)
{
- JASSERT(NULL != iter1);
- JASSERT(NULL != iter2);
+ JASSERT(NULL != iter1);
+ JASSERT(NULL != iter2);
- return (iter1->opaque_ == iter2->opaque_);
+ return (iter1->opaque_ == iter2->opaque_);
}
-
/**
* ****************************************************************************
*/
-struct json_object_iterator
-json_object_iter_init_default(void)
+struct json_object_iterator json_object_iter_init_default(void)
{
- struct json_object_iterator iter;
+ struct json_object_iterator iter;
- /**
+ /**
* @note Make this a negative, invalid value, such that
* accidental access to it would likely be trapped by the
* hardware as an invalid address.
*/
- iter.opaque_ = NULL;
+ iter.opaque_ = NULL;
- return iter;
+ return iter;
}