RESULT_ERROR_FMT -> RESULT_ERROR_HEAP

This commit is contained in:
2026-06-08 00:35:40 +05:00
parent b95b6b150d
commit 22a3a4cfe5
14 changed files with 95 additions and 53 deletions

View File

@@ -22,9 +22,10 @@ Result(Table*) toml_walk_table_path(TomlParser* parser, TomlTable* table,
TomlTable_set(real_table, part, new_table_value);
real_table = new_table_value.table;
} else {
Return RESULT_ERROR_CODE_FMT(TLIBTOML, TLIBTOML_ERR_SYNTAX,
char* err = sprintf_malloc(
"%s:%d:%d: not found key '" FMT_str "'",
parser->filename, parser->lineno, parser->colno, part.len, part.data);
Return RESULT_ERROR_CODE_HEAP(TLIBTOML, TLIBTOML_ERR_SYNTAX, err);
}
} else {
real_table = t->table;
@@ -41,15 +42,17 @@ Result(Table*) toml_walk_table_path(TomlParser* parser, TomlTable* table,
TomlTable_set(real_table, part, array_value);
real_table = new_table_value.table;
} else {
Return RESULT_ERROR_CODE_FMT(TLIBTOML, TLIBTOML_ERR_SYNTAX,
char* err = sprintf_malloc(
"%s:%d:%d: not found key '" FMT_str "'",
parser->filename, parser->lineno, parser->colno, part.len, part.data);
Return RESULT_ERROR_CODE_HEAP(TLIBTOML, TLIBTOML_ERR_SYNTAX, err);
}
} else {
if (t->type != TLIBTOML_ARRAY) {
Return RESULT_ERROR_CODE_FMT(TLIBTOML, TLIBTOML_ERR_SYNTAX,
char* err = sprintf_malloc(
"%s:%d:%d: this key was not an array",
parser->filename, parser->lineno, parser->colno);
Return RESULT_ERROR_CODE_HEAP(TLIBTOML, TLIBTOML_ERR_SYNTAX, err);
}
TomlValue new_table_value = TomlValue_new_table();
@@ -66,9 +69,10 @@ Result(Table*) toml_walk_table_path(TomlParser* parser, TomlTable* table,
TomlTable_set(real_table, part, new_table_value);
real_table = new_table_value.table;
} else {
Return RESULT_ERROR_CODE_FMT(TLIBTOML, TLIBTOML_ERR_SYNTAX,
char* err = sprintf_malloc(
"%s:%d:%d: not found key '" FMT_str "'",
parser->filename, parser->lineno, parser->colno, part.len, part.data);
Return RESULT_ERROR_CODE_HEAP(TLIBTOML, TLIBTOML_ERR_SYNTAX, err);
}
} else {
if (t->type == TLIBTOML_ARRAY) {