mirror of
https://github.com/json-c/json-c.git
synced 2026-03-24 15:39:07 +08:00
clang-format the files
This commit is contained in:
@@ -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;
|
||||
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 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;
|
||||
/// @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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user