commit 1d6925cb7655981ee846587cf062f188a602aeb6 parent 222f9cb53c6cf3c4ef25d6ee8b652f4b1ef4eef1 Author: sin <sin@2f30.org> Date: Wed, 14 May 2014 16:11:18 +0100 Add freeobject() Diffstat:
M | parser.c | | | 19 | +++++++++++++++++++ |
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/parser.c b/parser.c @@ -18,6 +18,25 @@ newobject(void) } struct object * +freeobject(struct object *o) +{ + if (!o) + return; + switch (o->type) { + case OError: + free(o->d.err.s); + break; + case OEof: + free(o->d.eof.s); + break; + case OString: + free(o->d.s.s); + break; + } + free(o); +} + +struct object * error(struct tok *t) { struct object *o;