* Bison error handling
@ 2005-11-02 18:25 Marco Gerards
2005-11-02 19:22 ` Marco Gerards
0 siblings, 1 reply; 2+ messages in thread
From: Marco Gerards @ 2005-11-02 18:25 UTC (permalink / raw)
To: grub-devel
Hi,
Hopefully any of you have either a clue about bison or an idea how to
solve this problem.
What happens now is that during parsing memory is allocated. If
everything is parsed there is a set of malloc'ed memory all pointing
to each other, etc.
The main problem is in case of a syntax error. In that case all of
the state should be released (free all memory structures). But I have
no idea how to do that; yyparse just returns an error. I need a way
to make bison return a valid structure so I can check if parsing
failed and release all of the memory.
One solution to this problem is making a big list of all memory
allocated while scanning and parsing. When parsing fails you just
free all of this memory. Otherwise everything is freed when the
datastructures are about to be de-allocated.
But I prefer a solution using bison stuff, otherwise I'll just use the
solution I described above.
--
Marco
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Bison error handling
2005-11-02 18:25 Bison error handling Marco Gerards
@ 2005-11-02 19:22 ` Marco Gerards
0 siblings, 0 replies; 2+ messages in thread
From: Marco Gerards @ 2005-11-02 19:22 UTC (permalink / raw)
To: The development of GRUB 2
Marco Gerards <metgerards@student.han.nl> writes:
> The main problem is in case of a syntax error. In that case all of
> the state should be released (free all memory structures). But I have
> no idea how to do that; yyparse just returns an error. I need a way
> to make bison return a valid structure so I can check if parsing
> failed and release all of the memory.
Because the bash people were not able to solve this problem (bash
leaks memory when a syntax error occurs!), I think I should assume I
can't either. So I just use my other solution for now. :-)
--
Marco
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-11-02 19:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-02 18:25 Bison error handling Marco Gerards
2005-11-02 19:22 ` Marco Gerards
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.