From 21c90d555a27321fca29f9b7466d57b5585b54b5 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 1 Apr 2011 21:21:40 +0000 Subject: Add calls to some existing but previously unused free functions. Also replace a loop with a memset. From Michael W Bombardieri. ok millert --- usr.bin/yacc/defs.h | 4 +++- usr.bin/yacc/lalr.c | 4 +++- usr.bin/yacc/lr0.c | 7 ++----- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'usr.bin/yacc') diff --git a/usr.bin/yacc/defs.h b/usr.bin/yacc/defs.h index 9708a43c065..32fe6082c15 100644 --- a/usr.bin/yacc/defs.h +++ b/usr.bin/yacc/defs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: defs.h,v 1.11 2005/06/08 03:18:59 pvalchev Exp $ */ +/* $OpenBSD: defs.h,v 1.12 2011/04/01 21:21:39 nicm Exp $ */ /* $NetBSD: defs.h,v 1.6 1996/03/19 03:21:30 jtc Exp $ */ /* @@ -358,6 +358,8 @@ extern void lalr(void); extern void reader(void); extern void lr0(void); +extern void free_nullable(void); +extern void free_derives(void); extern void make_parser(void); extern void verbose(void); extern void output(void); diff --git a/usr.bin/yacc/lalr.c b/usr.bin/yacc/lalr.c index 4e9a391c392..1be57b60b37 100644 --- a/usr.bin/yacc/lalr.c +++ b/usr.bin/yacc/lalr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lalr.c,v 1.9 2009/10/27 23:59:50 deraadt Exp $ */ +/* $OpenBSD: lalr.c,v 1.10 2011/04/01 21:21:39 nicm Exp $ */ /* $NetBSD: lalr.c,v 1.4 1996/03/19 03:21:33 jtc Exp $ */ /* @@ -99,6 +99,8 @@ lalr(void) build_relations(); compute_FOLLOWS(); compute_lookaheads(); + free_derives(); + free_nullable(); } diff --git a/usr.bin/yacc/lr0.c b/usr.bin/yacc/lr0.c index 7333a5d15e9..7cbb221a956 100644 --- a/usr.bin/yacc/lr0.c +++ b/usr.bin/yacc/lr0.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lr0.c,v 1.9 2009/10/27 23:59:50 deraadt Exp $ */ +/* $OpenBSD: lr0.c,v 1.10 2011/04/01 21:21:39 nicm Exp $ */ /* $NetBSD: lr0.c,v 1.4 1996/03/19 03:21:35 jtc Exp $ */ /* @@ -63,8 +63,6 @@ void save_reductions(void); void set_derives(void); void print_derives(void); void set_nullable(void); -void free_derives(void); -void free_nullable(void); static core **state_set; static core *this_state; @@ -602,8 +600,7 @@ set_nullable(void) nullable = MALLOC(nsyms); if (nullable == 0) no_space(); - for (i = 0; i < nsyms; ++i) - nullable[i] = 0; + memset(nullable, 0, nsyms); done = 0; while (!done) -- cgit v1.2.3