From 065f2fa4b9b4b2d40f5e0092f6f8a1aa6d13daaf Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Sat, 10 Feb 2018 16:02:22 -0800 Subject: [PATCH] Use the new error code conversion code. --- src/lexer.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lexer.c b/src/lexer.c index 26765f2..494487e 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -1,4 +1,5 @@ #include "lexer.h" +#include "libabacus_util.h" libab_result lexer_init(lexer* lexer) { size_t i; @@ -39,14 +40,12 @@ libab_result lexer_init(lexer* lexer) { eval_config_init(&lexer->config); for(i = 0; i < count && result == LIBAB_SUCCESS; i++) { - result = - (eval_config_add(&lexer->config, words[i], tokens[i]) == LIBLEX_SUCCESS) - ? LIBAB_SUCCESS : LIBAB_MALLOC; + result = convert_lex_result( + eval_config_add(&lexer->config, words[i], tokens[i])); } return result; } libab_result lexer_free(lexer* lexer) { - return (eval_config_free(&lexer->config) == LIBLEX_SUCCESS) ? - LIBAB_SUCCESS : LIBAB_MALLOC; + return convert_lex_result(eval_config_free(&lexer->config)); }