Eina_Bool ret = EINA_TRUE;
- if (!len)
- {
- ERR("%s: given size is 0", source);
- return EINA_FALSE;
- }
-
- if (len > BUFSIZE)
- {
- ERR("%s: buffer not enough big. Required size: %d", source, len);
- return EINA_FALSE;
- }
-
-#line 2762 "lib/eolian/eo_lexer.c"
+#line 2750 "lib/eolian/eo_lexer.c"
{
toknz->cs = eo_tokenizer_start;
toknz->ts = 0;
toknz->act = 0;
}
-#line 1073 "lib/eolian/eo_lexer.rl"
+#line 1061 "lib/eolian/eo_lexer.rl"
toknz->p = buffer;
toknz->eof = toknz->pe;
-#line 2779 "lib/eolian/eo_lexer.c"
+#line 2767 "lib/eolian/eo_lexer.c"
{
int _klen;
unsigned int _trans;
#line 1 "NONE"
{ toknz->ts = ( toknz->p);}
break;
-#line 2798 "lib/eolian/eo_lexer.c"
+#line 2786 "lib/eolian/eo_lexer.c"
}
}
{( toknz->p)++; goto _out; } /* necessary to stop scanners */
}}
break;
-#line 4130 "lib/eolian/eo_lexer.c"
+#line 4118 "lib/eolian/eo_lexer.c"
}
}
#line 1 "NONE"
{ toknz->ts = 0;}
break;
-#line 4143 "lib/eolian/eo_lexer.c"
+#line 4131 "lib/eolian/eo_lexer.c"
}
}
_out: {}
}
-#line 1081 "lib/eolian/eo_lexer.rl"
+#line 1069 "lib/eolian/eo_lexer.rl"
if ( toknz->cs ==
-#line 4164 "lib/eolian/eo_lexer.c"
+#line 4152 "lib/eolian/eo_lexer.c"
-1
-#line 1082 "lib/eolian/eo_lexer.rl"
+#line 1070 "lib/eolian/eo_lexer.rl"
)
{
ERR("%s: wrong termination", source);
}
buffer = malloc(BUFSIZE);
+ if (!buffer)
+ {
+ ERR("unable to allocate read buffer");
+ goto end;
+ }
+
unsigned int len = fread(buffer, 1, BUFSIZE, stream);
+ if (!len)
+ {
+ ERR("%s: is an empty file", filename);
+ goto end;
+ }
+
+ if (len == BUFSIZE)
+ WRN("%s: buffer(%d) is full, might not be big enough.", filename, len);
+
if (!eo_tokenizer_mem_walk(toknz, filename, buffer, len)) goto end;
if (!toknz->classes)
Eina_Bool ret = EINA_TRUE;
- if (!len)
- {
- ERR("%s: given size is 0", source);
- return EINA_FALSE;
- }
-
- if (len > BUFSIZE)
- {
- ERR("%s: buffer not enough big. Required size: %d", source, len);
- return EINA_FALSE;
- }
-
%% write init;
toknz->p = buffer;
}
buffer = malloc(BUFSIZE);
+ if (!buffer)
+ {
+ ERR("unable to allocate read buffer");
+ goto end;
+ }
+
unsigned int len = fread(buffer, 1, BUFSIZE, stream);
+ if (!len)
+ {
+ ERR("%s: is an empty file", filename);
+ goto end;
+ }
+
+ if (len == BUFSIZE)
+ WRN("%s: buffer(%d) is full, might not be big enough.", filename, len);
+
if (!eo_tokenizer_mem_walk(toknz, filename, buffer, len)) goto end;
if (!toknz->classes)