/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ /* * Copyright (c) 2019 Amlogic, Inc. All rights reserved. */ #ifndef __INI_HANDLER_H__ #define __INI_HANDLER_H__ #include "ini_size_define.h" typedef struct S_INI_LINE { struct S_INI_LINE *pNext; char Name[CC_MAX_INI_LINE_NAME_LEN]; unsigned int value_size; char *Value; } INI_LINE; typedef struct S_INI_SECTION { INI_LINE* pLine; INI_LINE* pCurLine; struct S_INI_SECTION *pNext; char Name[CC_MAX_INI_LINE_NAME_LEN]; } INI_SECTION; typedef struct S_INI_HANDLER_DATA { INI_SECTION* mpFirstSection; INI_SECTION* mpCurSection; char mpFileName[CC_MAX_INI_FILE_NAME_LEN]; void *data; } INI_HANDLER_DATA; #ifdef __cplusplus extern "C" { #endif int _bin_file_read(const char *filename, unsigned char *file_buf); int _ini_file_parse(const char *filename, INI_HANDLER_DATA *pHandlerData); int ini_mem_parse(unsigned char *file_buf, INI_HANDLER_DATA *pHandlerData); int _ini_set_save_file_name(const char *filename, INI_HANDLER_DATA *pHandlerData); void _ini_free_mem(INI_HANDLER_DATA *pHandlerData); void _ini_print_all(INI_HANDLER_DATA *pHandlerData); void _ini_list_section(INI_HANDLER_DATA *pHandlerData); int _ini_section_exist(const char *section, INI_HANDLER_DATA *pHandlerData); const char *_ini_get_string(const char *section, const char *key, const char *def_value, INI_HANDLER_DATA *pHandlerData); int _ini_set_string(const char *section, const char *key, const char *value, INI_HANDLER_DATA *pHandlerData); int _ini_save_to_file(const char *filename, INI_HANDLER_DATA *pHandlerData); #ifdef __cplusplus } #endif //for memory malloc & free debug //#define CC_MEMORY_ALLOC_FREE_TRACE (1) //remove for it will cause memory issue #define CC_MEMORY_ALLOC_FREE_TRACE_PRINT_ALL (0) #endif //__INI_HANDLER_H__