diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2021-09-09 12:09:12 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2021-09-09 12:09:12 +0000 |
commit | 6ecab1fd02b8919f279004a58467aec1fa23c228 (patch) | |
tree | 5f71fc2f1dc00e8165ddcba2ed6e0f3d11873feb /usr.sbin/btrace | |
parent | cf0db4d08da7321d9dc2b43ee85d1446cadf9460 (diff) |
Relax the check for accessing variable before setting them.
First we can't assume rules are written in the order they will be executed.
Secondly filters might need to check variables before they had a chance to
be populated by the right event.
Diffstat (limited to 'usr.sbin/btrace')
-rw-r--r-- | usr.sbin/btrace/bt_parse.y | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/usr.sbin/btrace/bt_parse.y b/usr.sbin/btrace/bt_parse.y index 196edc4e28a..faf2b05f119 100644 --- a/usr.sbin/btrace/bt_parse.y +++ b/usr.sbin/btrace/bt_parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: bt_parse.y,v 1.42 2021/09/09 09:53:11 mpi Exp $ */ +/* $OpenBSD: bt_parse.y,v 1.43 2021/09/09 12:09:11 mpi Exp $ */ /* * Copyright (c) 2019-2021 Martin Pieuchot <mpi@openbsd.org> @@ -535,13 +535,7 @@ bg_get(const char *vname) struct bt_arg * bg_find(const char *vname) { - struct bt_var *bv; - - bv = bg_lookup(vname); - if (bv == NULL) - yyerror("variable '%s' accessed before being set", vname); - - return ba_new(bv, B_AT_VAR); + return ba_new(bg_get(vname), B_AT_VAR); } /* Create a 'store' statement to assign a value to a global variable. */ @@ -617,14 +611,9 @@ bm_insert(const char *mname, struct bt_arg *mkey, struct bt_arg *mval) struct bt_arg * bm_find(const char *vname, struct bt_arg *mkey) { - struct bt_var *bv; struct bt_arg *ba; - bv = bg_lookup(vname); - if (bv == NULL) - yyerror("variable '%s' accessed before being set", vname); - - ba = ba_new(bv, B_AT_MAP); + ba = ba_new(bg_get(vname), B_AT_MAP); ba->ba_key = mkey; return ba; } |