src/core/config/parser.c
/**
 * Here we will handle the creation of a simple string value
 */
Here we will handle the creation of a simple string value
Here we will handle the creation of a simple string value
static struct config_value *parser_parse_string(const struct parser *parser, char *string)
{
        size_t string_len = strlen(string);
        char *stripped_string = NULL;
        if (string_splice(string, 1, string_len - 1, &stripped_string, NULL) != NO_ERROR) {
                LOG_ERROR(natwm_logger,
                          "Invalid string '%s' found - Line %zu",
                          string,
                          parser->line_num);
                return NULL;
        }
        struct config_value *config_value = config_value_create_string(stripped_string);
        if (config_value == NULL) {
                free(stripped_string);
                return NULL;
        }
        free(string);
        return config_value;
}
static struct config_value * parser_parse_string ( const struct parser * parser , char * string ) { size_t string_len = strlen ( string ) ; char * stripped_string = NULL ; if ( string_splice ( string , 1 , string_len - 1 , & stripped_string , NULL ) != NO_ERROR ) { LOG_ERROR ( natwm_logger , " " , string , parser -> line_num ) ; return NULL ; } struct config_value * config_value = config_value_create_string ( stripped_string ) ; if ( config_value == NULL ) { free ( stripped_string ) ; return NULL ; } free ( string ) ; return config_value ; }
Here we will handle the creation of a simple string value
Here we will handle the creation of a simple string value
// We first need to strip off the surrounding quotes from the string