src/core/config/parser.c
/**
 * Initialize the parser with the file buffer.
 *
 * This will be used to track the position of the parser in the file.
 */
Initialize the parser with the file buffer.
This will be used to track the position of the parser in the file.
Initialize the parser with the file buffer . This will be used to track the position of the parser in the file .
struct parser *parser_create(const char *buffer, size_t buffer_size)
{
        struct parser *parser = malloc(sizeof(struct parser));
        if (parser == NULL) {
                return NULL;
        }
        parser->buffer = buffer;
        parser->buffer_size = buffer_size;
        parser->pos = 0;
        parser->line_num = 1;
        parser->col_num = 1;
        parser->variables = map_init();
        if (parser->variables == NULL) {
                free(parser);
                return NULL;
        }
        map_set_entry_free_function(parser->variables, hashmap_free_callback);
        map_set_setting_flag(parser->variables, MAP_FLAG_FREE_ENTRY_KEY);
        return parser;
}
struct parser * parser_create ( const char * buffer , size_t buffer_size ) { struct parser * parser = malloc ( sizeof ( struct parser ) ) ; if ( parser == NULL ) { return NULL ; } parser -> buffer = buffer ; parser -> buffer_size = buffer_size ; parser -> pos = 0 ; parser -> line_num = 1 ; parser -> col_num = 1 ; parser -> variables = map_init ( ) ; if ( parser -> variables == NULL ) { free ( parser ) ; return NULL ; } map_set_entry_free_function ( parser -> variables , hashmap_free_callback ) ; map_set_setting_flag ( parser -> variables , MAP_FLAG_FREE_ENTRY_KEY ) ; return parser ; }
Initialize the parser with the file buffer.
Initialize the parser with the file buffer .
// Set up hashmap