| collection.h | | collection.h | |
| | | | |
| skipping to change at line 500 | | skipping to change at line 500 | |
| * @param[in] property_len Length of the property name | | * @param[in] property_len Length of the property name | |
| * will be passed in this parameter. | | * will be passed in this parameter. | |
| * @param[in] type Type of the data will be passed | | * @param[in] type Type of the data will be passed | |
| * in this parameter. | | * in this parameter. | |
| * @param[in] data Pointer to the data will be passed | | * @param[in] data Pointer to the data will be passed | |
| * in this parameter. | | * in this parameter. | |
| * @param[in] length Length of data will be passed in | | * @param[in] length Length of data will be passed in | |
| * this parameter. | | * this parameter. | |
| * @param[in] custom_data Custom data will be passed in | | * @param[in] custom_data Custom data will be passed in | |
| * this parameter. | | * this parameter. | |
|
| * @return No return value. | | | |
| */ | | */ | |
| | | | |
| typedef void (*col_item_cleanup_fn)(const char *property, | | typedef void (*col_item_cleanup_fn)(const char *property, | |
| int property_len, | | int property_len, | |
| int type, | | int type, | |
| void *data, | | void *data, | |
| int length, | | int length, | |
| void *custom_data); | | void *custom_data); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 1764 | | skipping to change at line 1763 | |
| int col_insert_int_property(struct collection_item *ci, | | int col_insert_int_property(struct collection_item *ci, | |
| const char *subcollection, | | const char *subcollection, | |
| int disposition, | | int disposition, | |
| const char *refprop, | | const char *refprop, | |
| int idx, | | int idx, | |
| unsigned flags, | | unsigned flags, | |
| const char *property, | | const char *property, | |
| int32_t number); | | int32_t number); | |
| | | | |
| /** @brief Insert an unsigned property. */ | | /** @brief Insert an unsigned property. */ | |
|
| int col_insert_unsinged_property(struct collection_item *ci, | | int col_insert_unsigned_property(struct collection_item *ci, | |
| const char *subcollection, | | const char *subcollection, | |
| int disposition, | | int disposition, | |
| const char *refprop, | | const char *refprop, | |
| int idx, | | int idx, | |
| unsigned flags, | | unsigned flags, | |
| const char *property, | | const char *property, | |
| uint32_t number); | | uint32_t number); | |
| | | | |
| /** @brief Insert a long property. */ | | /** @brief Insert a long property. */ | |
| int col_insert_long_property(struct collection_item *ci, | | int col_insert_long_property(struct collection_item *ci, | |
| | | | |
| skipping to change at line 1849 | | skipping to change at line 1848 | |
| const char *subcollection, | | const char *subcollection, | |
| int disposition, | | int disposition, | |
| const char *refprop, | | const char *refprop, | |
| int idx, | | int idx, | |
| unsigned flags, | | unsigned flags, | |
| const char *property, | | const char *property, | |
| int32_t number, | | int32_t number, | |
| struct collection_item **ret_ref); | | struct collection_item **ret_ref); | |
| | | | |
| /** @brief Insert an unsigned property and get back a reference. */ | | /** @brief Insert an unsigned property and get back a reference. */ | |
|
| int col_insert_unsinged_property_with_ref(struct collection_item *ci, | | int col_insert_unsigned_property_with_ref(struct collection_item *ci, | |
| const char *subcollection, | | const char *subcollection, | |
| int disposition, | | int disposition, | |
| const char *refprop, | | const char *refprop, | |
| int idx, | | int idx, | |
| unsigned flags, | | unsigned flags, | |
| const char *property, | | const char *property, | |
| uint32_t number, | | uint32_t number, | |
| struct collection_item **ret_ref)
; | | struct collection_item **ret_ref)
; | |
| | | | |
| /** @brief Insert a long property and get back a reference. */ | | /** @brief Insert a long property and get back a reference. */ | |
| | | | |
| skipping to change at line 3190 | | skipping to change at line 3189 | |
| * to make same amount of comparisons in traditional | | * to make same amount of comparisons in traditional | |
| * or "pinned" case to not find them. | | * or "pinned" case to not find them. | |
| * To find "F" in pinned case there will be just one | | * To find "F" in pinned case there will be just one | |
| * comparison. | | * comparison. | |
| * - Traditional case = 1 + 3 + 2 + 3 + 3 + 3 = 15 | | * - Traditional case = 1 + 3 + 2 + 3 + 3 + 3 = 15 | |
| * - Pinned case = 1 + 3 + 1 + 3 + 3 + 1 = 12 | | * - Pinned case = 1 + 3 + 1 + 3 + 3 + 1 = 12 | |
| * | | * | |
| * It is a 20% comparison reduction. | | * It is a 20% comparison reduction. | |
| * | | * | |
| * @param[in] iterator Iterator object to use. | | * @param[in] iterator Iterator object to use. | |
|
| * | | | |
| * @return 0 - Success. | | | |
| * @return EINVAL - The value of the argument is invalid. | | | |
| */ | | */ | |
| void col_pin_iterator(struct collection_iterator *iterator); | | void col_pin_iterator(struct collection_iterator *iterator); | |
| | | | |
| /** | | /** | |
| * @brief Rewind iterator | | * @brief Rewind iterator | |
| * | | * | |
| * Rewinds iterator to the current pin point which is by | | * Rewinds iterator to the current pin point which is by | |
| * default the beginning of the collection until changed by | | * default the beginning of the collection until changed by | |
| * \ref col_pin_iterator function. | | * \ref col_pin_iterator function. | |
| * | | * | |
| * @param[in] iterator Iterator object to use. | | * @param[in] iterator Iterator object to use. | |
|
| * | | | |
| * @return 0 - Success. | | | |
| * @return EINVAL - The value of the argument is invalid. | | | |
| */ | | */ | |
| void col_rewind_iterator(struct collection_iterator *iterator); | | void col_rewind_iterator(struct collection_iterator *iterator); | |
| | | | |
| /** | | /** | |
| * @} | | * @} | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @} | | * @} | |
| */ | | */ | |
| | | | |
End of changes. 5 change blocks. |
| 9 lines changed or deleted | | 2 lines changed or added | |
|
| ini_configobj.h | | ini_configobj.h | |
| | | | |
| skipping to change at line 176 | | skipping to change at line 176 | |
| ERR_READ, /**< Failed to read line (Error). */ | | ERR_READ, /**< Failed to read line (Error). */ | |
| ERR_SPACE, /**< Line starts with space when it | | ERR_SPACE, /**< Line starts with space when it | |
| should not (Error). */ | | should not (Error). */ | |
| ERR_DUPKEY, /**< Duplicate key is not allowed (Error). */ | | ERR_DUPKEY, /**< Duplicate key is not allowed (Error). */ | |
| ERR_DUPKEYSEC, /**< Duplicate key is detected while merging | | ERR_DUPKEYSEC, /**< Duplicate key is detected while merging | |
| sections (Error). */ | | sections (Error). */ | |
| ERR_DUPSECTION, /**< Duplicate section is not allowed (Error). */ | | ERR_DUPSECTION, /**< Duplicate section is not allowed (Error). */ | |
| ERR_SPECIAL, /**< Line contains invalid characters (Error). */ | | ERR_SPECIAL, /**< Line contains invalid characters (Error). */ | |
| ERR_TAB, /**< Line starts with tab when it | | ERR_TAB, /**< Line starts with tab when it | |
| should not (Error). */ | | should not (Error). */ | |
|
| ERR_MAXPARSE = ERR_TAB /**< Special value. Size of the error array. */ | | ERR_BADCOMMENT, /**< End of file while processing comment (Error). */ | |
| | | ERR_MAXPARSE = ERR_BADCOMMENT /**< Special value. Size of the error arr | |
| | | ay. */ | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * @} | | * @} | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @defgroup metacollect Constants that define what meta data to collect | | * @defgroup metacollect Constants that define what meta data to collect | |
| * | | * | |
| * Constants in this section define what meta data to collect | | * Constants in this section define what meta data to collect | |
| | | | |
| skipping to change at line 332 | | skipping to change at line 333 | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @defgroup parseflags Flags that define parsing rules | | * @defgroup parseflags Flags that define parsing rules | |
| * | | * | |
| * Flags that define how the file should be parsed. | | * Flags that define how the file should be parsed. | |
| * | | * | |
| * @{ | | * @{ | |
| */ | | */ | |
| | | | |
|
| /** @brief Do not wrap */ | | /** @brief Suppress multi line value wrapping */ | |
| #define INI_PARSE_NOWRAP 0x0001 | | #define INI_PARSE_NOWRAP 0x0001 | |
| /** @brief No spaces are allowed to the left of the key */ | | /** @brief No spaces are allowed to the left of the key */ | |
|
| #define INI_PARSE_NOSPACE 0x0002 | | #define INI_PARSE_NOSPACE 0x0002 | |
| /** @brief No tabs are allowed to the left of the key */ | | /** @brief No tabs are allowed to the left of the key */ | |
|
| #define INI_PARSE_NOTAB 0x0004 | | #define INI_PARSE_NOTAB 0x0004 | |
| | | /** @brief Do not allow C-style comments */ | |
| | | #define INI_PARSE_NO_C_COMMENTS 0x0008 | |
| | | | |
| /** | | /** | |
| * @} | | * @} | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @defgroup searchmode Constants that define how to look for a value | | * @defgroup searchmode Constants that define how to look for a value | |
| * | | * | |
| * Configuration file can allow several keys with the same name | | * Configuration file can allow several keys with the same name | |
| * in one section. Use the constants below to define which | | * in one section. Use the constants below to define which | |
| | | | |
| skipping to change at line 478 | | skipping to change at line 481 | |
| * | | * | |
| * @return 0 - Success. | | * @return 0 - Success. | |
| * @return EINVAL - Invalid parameter. | | * @return EINVAL - Invalid parameter. | |
| * @return ENOMEM - No memory. | | * @return ENOMEM - No memory. | |
| */ | | */ | |
| int ini_config_file_open(const char *filename, | | int ini_config_file_open(const char *filename, | |
| uint32_t metadata_flags, | | uint32_t metadata_flags, | |
| struct ini_cfgfile **file_ctx); | | struct ini_cfgfile **file_ctx); | |
| | | | |
| /** | | /** | |
|
| | | * @brief Create a configuration file object using memory buffer. | |
| | | * | |
| | | * Create a file object for parsing a configuration file. | |
| | | * Configuration will use provided memory instead of the actual file. | |
| | | * | |
| | | * A "configuration file object" is different from | |
| | | * a "configuration object". The former stores metadata | |
| | | * about a file the configuration data is read from, | |
| | | * while the latter holds the configuration itself. | |
| | | * | |
| | | * @param[in] data_buf In memory configuration data. | |
| | | * Needs to be NULL terminated. | |
| | | * @param[in] data_len Length of memory data | |
| | | * not including terminating NULL. | |
| | | * @param[out] file_ctx Configuration file object. | |
| | | * | |
| | | * @return 0 - Success. | |
| | | * @return EINVAL - Invalid parameter. | |
| | | * @return ENOMEM - No memory. | |
| | | */ | |
| | | int ini_config_file_from_mem(void *data_buf, | |
| | | uint32_t data_len, | |
| | | struct ini_cfgfile **file_ctx); | |
| | | | |
| | | /** | |
| * @brief Close configuration file after parsing | | * @brief Close configuration file after parsing | |
| * | | * | |
| * Closes file but keeps the context. File can be reopened | | * Closes file but keeps the context. File can be reopened | |
| * and reread using \ref ini_config_file_reopen function. | | * and reread using \ref ini_config_file_reopen function. | |
| * | | * | |
| * @param[in] file_ctx Configuration file object. | | * @param[in] file_ctx Configuration file object. | |
| * | | * | |
| */ | | */ | |
| void ini_config_file_close(struct ini_cfgfile *file_ctx); | | void ini_config_file_close(struct ini_cfgfile *file_ctx); | |
| | | | |
| | | | |
| skipping to change at line 685 | | skipping to change at line 713 | |
| * Function parses the file. It is assumed that | | * Function parses the file. It is assumed that | |
| * the configuration object was just created. | | * the configuration object was just created. | |
| * Using a non empty configuration object in | | * Using a non empty configuration object in | |
| * a parsing operation would fail with EINVAL. | | * a parsing operation would fail with EINVAL. | |
| * | | * | |
| * @param[in] file_ctx Configuration file object. | | * @param[in] file_ctx Configuration file object. | |
| * @param[in] error_level Flags that control actions | | * @param[in] error_level Flags that control actions | |
| * in case of parsing error. | | * in case of parsing error. | |
| * @param[in] collision_flags Flags that control handling | | * @param[in] collision_flags Flags that control handling | |
| * of the duplicate sections or keys. | | * of the duplicate sections or keys. | |
|
| | | * @param[in] parse_flags Flags that control parsing process, | |
| | | * for example how to handle spaces at | |
| | | * the beginning of the line. | |
| * @param[out] ini_config Configuration object. | | * @param[out] ini_config Configuration object. | |
| * | | * | |
| * @return 0 - Success. | | * @return 0 - Success. | |
| * @return EINVAL - Invalid parameter. | | * @return EINVAL - Invalid parameter. | |
| * @return ENOMEM - No memory. | | * @return ENOMEM - No memory. | |
| */ | | */ | |
| int ini_config_parse(struct ini_cfgfile *file_ctx, | | int ini_config_parse(struct ini_cfgfile *file_ctx, | |
| int error_level, | | int error_level, | |
| uint32_t collision_flags, | | uint32_t collision_flags, | |
| uint32_t parse_flags, | | uint32_t parse_flags, | |
| | | | |
End of changes. 6 change blocks. |
| 5 lines changed or deleted | | 37 lines changed or added | |
|