+2013-11-16 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Decrease stack usage in lexer.
+
+ We have only 92K of stack and using over 4K per frame is wasteful
+
+ * grub-core/script/yylex.l (yyalloc), (yyfree), (yyrealloc): Declare
+ as macros so that compiler would remove useless structure on stack.
+ Better solution would be to fix flex not to put this structure on
+ the stack but flex is external program.
+
2013-11-16 Vladimir Serbinenko <phcoder@gmail.com>
Decrease stack usage in signature verification.
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wsign-compare"
-#define yyfree grub_lexer_yyfree
-#define yyalloc grub_lexer_yyalloc
-#define yyrealloc grub_lexer_yyrealloc
+#define yyalloc(size, scanner) (grub_malloc((size)))
+#define yyfree(ptr, scanner) (grub_free((ptr)))
+#define yyrealloc(ptr, size, scanner) (grub_realloc((ptr), (size)))
/*
* As we don't have access to yyscanner, we cannot do much except to
static int grub_lexer_unput (const char *input, yyscan_t yyscanner);
static int grub_lexer_resplit (const char *input, yyscan_t yyscanner);
-static void grub_lexer_yyfree (void *, yyscan_t yyscanner);
-static void* grub_lexer_yyalloc (yy_size_t, yyscan_t yyscanner);
-static void* grub_lexer_yyrealloc (void*, yy_size_t, yyscan_t yyscanner);
static void copy_string (struct grub_parser_param *, const char *,
unsigned hint);
return grub_script_lexer_yywrap (yyget_extra (yyscanner), 0);
}
-static void
-grub_lexer_yyfree (void *ptr, yyscan_t yyscanner __attribute__ ((unused)))
-{
- grub_free(ptr);
-}
-
-static void*
-grub_lexer_yyalloc (yy_size_t size, yyscan_t yyscanner __attribute__ ((unused)))
-{
- return grub_malloc (size);
-}
-
-static void*
-grub_lexer_yyrealloc (void *ptr, yy_size_t size,
- yyscan_t yyscanner __attribute__ ((unused)))
-{
- return grub_realloc (ptr, size);
-}
-
static void copy_string (struct grub_parser_param *parser, const char *str, unsigned hint)
{
grub_size_t size;