summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-11-23 17:45:34 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2013-11-23 17:45:34 +0100
commit80f6f356a4618a8c2eb1416f48406a192f5608a6 (patch)
treefe32dfa265c852d347244e1643a7b596e6126c11
parentfd16225902751a881e4da2161e20822c387113b9 (diff)
downloadeo_tokenizer-80f6f356a4618a8c2eb1416f48406a192f5608a6.zip
eo_tokenizer-80f6f356a4618a8c2eb1416f48406a192f5608a6.tar.gz
add _eo_tokenizer_abort()
-rw-r--r--eo_tokenizer.rl14
1 files 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);