From 37371f1cdcf351e29bf542e6b2fc269b29a4fba2 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 6 Dec 2022 18:24:08 -0800 Subject: cppsetup: use C99 struct initialization Signed-off-by: Alan Coopersmith --- cppsetup.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/cppsetup.c b/cppsetup.c index e0fe51b..3868cbe 100644 --- a/cppsetup.c +++ b/cppsetup.c @@ -114,19 +114,20 @@ int cppsetup(const char *filename, const char *line, struct filepointer *filep, struct inclist *inc) { - IfParser ip; - struct _parse_data pd; + struct _parse_data pd = { + .filep = filep, + .inc = inc, + .line = line, + .filename = filename + }; + IfParser ip = { + .funcs.handle_error = my_if_errors, + .funcs.eval_defined = my_eval_defined, + .funcs.eval_variable = my_eval_variable, + .data = &pd + }; long val = 0; - pd.filep = filep; - pd.inc = inc; - pd.line = line; - pd.filename = filename; - ip.funcs.handle_error = my_if_errors; - ip.funcs.eval_defined = my_eval_defined; - ip.funcs.eval_variable = my_eval_variable; - ip.data = &pd; - (void) ParseIfExpression(&ip, line, &val); if (val) return IF; -- cgit v1.2.3