aboutsummaryrefslogtreecommitdiff
path: root/ini_file.h
diff options
context:
space:
mode:
authorClecio Jung2023-03-23 13:16:18 -0300
committerClecio Jung2023-03-23 13:16:18 -0300
commit308925f81dcac05471e818865a94061f3421f217 (patch)
tree48e4bd797a0a6dd04b971c20598c5476d6cf5fed /ini_file.h
parent26f25a80f790a014115dd25e9619d059716bdfbd (diff)
downloadlibini-308925f81dcac05471e818865a94061f3421f217.tar.xz
libini-308925f81dcac05471e818865a94061f3421f217.tar.zst
Simplifying memory management
Diffstat (limited to 'ini_file.h')
-rw-r--r--ini_file.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/ini_file.h b/ini_file.h
index 7bd0eaf..2dbbea3 100644
--- a/ini_file.h
+++ b/ini_file.h
@@ -62,10 +62,6 @@
struct String_Buffer {
char buffer[4096];
struct String_Buffer *next;
- /* This index points to the next valid location to store the string.
- * If the buffer is full, the index will equal -1. In this case we shall
- * use one of the next buffers. */
- int index;
};
#endif
@@ -85,6 +81,8 @@ struct Ini_Section {
struct Ini_File {
#ifdef USE_CUSTOM_STRING_ALLOCATOR
struct String_Buffer *strings;
+ /* This index points to the next valid location in the buffer to store the string. */
+ size_t string_index;
#endif
/* The sections of the ini file are stored in a dynamic array */
size_t sections_size;
@@ -125,6 +123,8 @@ void ini_file_free(struct Ini_File *const ini_file);
void ini_section_print_to(const struct Ini_Section *const ini_section, FILE *const sink);
void ini_file_print_to(const struct Ini_File *const ini_file, FILE *const sink);
char *ini_file_error_to_string(const enum Ini_File_Errors error);
+/* This function is usefull for debug purposes */
+void ini_file_info(const struct Ini_File *const ini_file);
/* Remember to free the memory allocated for the returned ini file structure */
struct Ini_File *ini_file_parse(const char *const filename, Ini_File_Error_Callback callback);