Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/menuc Use OPT_NOMENU instead of -1
details: https://anonhg.NetBSD.org/src/rev/ffebfed5ba51
branches: trunk
changeset: 999918:ffebfed5ba51
user: christos <christos%NetBSD.org@localhost>
date: Sun Jun 23 22:48:15 2019 +0000
description:
Use OPT_NOMENU instead of -1
diffstat:
usr.bin/menuc/parse.y | 19 ++++++-------------
1 files changed, 6 insertions(+), 13 deletions(-)
diffs (62 lines):
diff -r ed674282beb9 -r ffebfed5ba51 usr.bin/menuc/parse.y
--- a/usr.bin/menuc/parse.y Sun Jun 23 22:47:22 2019 +0000
+++ b/usr.bin/menuc/parse.y Sun Jun 23 22:48:15 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.y,v 1.18 2019/02/25 20:47:37 martin Exp $ */
+/* $NetBSD: parse.y,v 1.19 2019/06/23 22:48:15 christos Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@@ -40,6 +40,7 @@
static id_rec *cur_menu;
static optn_info *cur_optn;
+#define OPT_NOMENU 0
%}
@@ -107,8 +108,7 @@
if (cur_menu->info != NULL)
yyerror ("Menu %s defined twice", $2);
else {
- cur_menu->info =
- (menu_info *) malloc (sizeof (menu_info));
+ cur_menu->info = malloc (sizeof (menu_info));
*(cur_menu->info) = default_info;
}
}
@@ -166,15 +166,8 @@
;
option : OPTION
- { cur_optn = (optn_info *) malloc (sizeof(optn_info));
- cur_optn->menu = -1;
- cur_optn->name = NULL;
- cur_optn->name_is_code = FALSE;
- cur_optn->issub = FALSE;
- cur_optn->doexit = FALSE;
+ { cur_optn = calloc(1, sizeof(*cur_optn));
cur_optn->optact.code = "";
- cur_optn->optact.endwin = FALSE;
- cur_optn->next = NULL;
}
option_legend ","
elem_list ";"
@@ -190,7 +183,7 @@
elem : NEXT MENU NAME
{ id_rec *t = get_menu ($3);
- if (cur_optn->menu != -1)
+ if (cur_optn->menu != OPT_NOMENU)
yyerror ("Double sub/next menu definition");
else {
cur_optn->menu = t->menu_no;
@@ -198,7 +191,7 @@
}
| SUB MENU NAME
{ id_rec *t = get_menu ($3);
- if (cur_optn->menu != -1)
+ if (cur_optn->menu != OPT_NOMENU)
yyerror ("Double sub/next menu definition");
else {
cur_optn->menu = t->menu_no;
Home |
Main Index |
Thread Index |
Old Index