减少接口

This commit is contained in:
suncb 2020-07-21 11:27:29 +08:00
parent af950ec919
commit fc20724c12
2 changed files with 6 additions and 23 deletions

View File

@ -192,7 +192,7 @@ typedef void* (*loop_func_t)(void* pData, const reflect_item_t* tbl);
*
* @return void.
*/
void csonLoopProperty(void* obj, const reflect_item_t* tbl, loop_func_t func);
void csonLoopProperty(void* obj, const reflect_item_t* tbl, loop_func_t func);
/**
* @brief convert json string to struct object.
@ -237,31 +237,10 @@ void csonPrintProperty(void* pData, const reflect_item_t* tbl);
void csonFreePointer(void* list, const reflect_item_t* tbl);
/*
for Multidimensional array support
for Multidimensional array support
*/
typedef size_t cson_array_size_t;
/**
* @brief get array memory.
*
* @param count: count of array item
* @param sizePerItem: bytes per array time
*
* @return void*.
* @attention Array header information is implied, so don't use malloc directly.
*/
void* csonArrayAlloc(cson_array_size_t count, cson_array_size_t sizePerItem);
/**
* @brief free array memory.
*
* @param ptr: array memory to be free.
*
* @return void.
* @attention Array header information is implied, so don't use free directly.
*/
void csonArrayFree(void* ptr);
/**
* @brief fast alloc multi-dimen array
*
@ -277,6 +256,7 @@ void* csonAllocMultiDimenArray(int dimen, cson_array_size_t* sizePerDimen, size_
* @brief the description of multidimensional array.
*/
void csonFreeMultiDimenArray(void* p);
typedef struct {
cson_array_size_t size;
cson_array_size_t cap;

View File

@ -175,6 +175,9 @@ static void* parseJsonMDArrayTail(cson_t jo_tmp, const reflect_item_t* tbl, int
static void csonLoopPropertyMDArraySub(void* pProperty, const reflect_item_t* tbl, int i, int dimen, loop_func_t func);
static int invalidCountField(const reflect_item_t* tbl);
static void csonArrayFree(void* ptr);
static void* csonArrayAlloc(cson_array_size_t count, cson_array_size_t sizePerItem);
int csonStruct2JsonStr(char** jstr, void* input, const reflect_item_t* tbl)
{
cson_t jsonPack = cson_object();