From 80f6f356a4618a8c2eb1416f48406a192f5608a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 23 Nov 2013 16:45:34 +0000 Subject: add _eo_tokenizer_abort() --- eo_tokenizer.rl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/eo_tokenizer.rl b/eo_tokenizer.rl index 019867a..f2ffddb 100644 --- a/eo_tokenizer.rl +++ b/eo_tokenizer.rl @@ -3,6 +3,17 @@ #include "eo_tokenizer.h" +static void +_eo_tokenizer_abort(Eo_Tokenizer *toknz, + const char *file, const char* fct, int line, + const char *msg) +{ + eina_log_print(_eo_tokenizer_log_dom, EINA_LOG_LEVEL_ERR, file, fct, line, msg); + eo_tokenizer_dump(toknz); + exit(EXIT_FAILURE); +} +#define ABORT(toknz, msg) _eo_tokenizer_abort(toknz, __FILE__, __FUNCTION__, __LINE__, msg); + %%{ machine common; @@ -100,9 +111,8 @@ eo_tokenizer_walk(Eo_Tokenizer *toknz, const char *source) if (space == 0) { - ERR("out of buffer space"); fclose(stream); - exit(EXIT_FAILURE); + ABORT(toknz, "out of buffer space"); } len = fread(toknz->p, 1, space, stream); -- cgit v1.1-2-g2b99