From 3fe831fc7a3d5b89487918d74419c40a5c2e2f70 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Thu, 4 Aug 2022 18:41:06 -0700 Subject: [PATCH] expr exccopen: only pass SFIO stream to callback This function invokes `dtwalk` passing the callback `global` to be called with a state parameter it supplies. It was supplying `cc`, but the callback only uses a single member of this struct. So we can simplify this code by just passing the stream the callback writes to, `cc->ccdisc-text`, or equivalently `disc->text`. --- lib/expr/excc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/expr/excc.c b/lib/expr/excc.c index 0f119e2b7..9e40ba739 100644 --- a/lib/expr/excc.c +++ b/lib/expr/excc.c @@ -624,11 +624,11 @@ global(Dt_t* table, void* object, void* handle) { (void)table; - Excc_t* cc = handle; + Sfio_t *stream = handle; Exid_t* sym = object; if (sym->lex == DYNAMIC) - sfprintf(cc->ccdisc->text, "static %s %s;\n", extype(sym->type), sym->name); + sfprintf(stream, "static %s %s;\n", extype(sym->type), sym->name); return 0; } @@ -657,7 +657,7 @@ exccopen(Expr_t* expr, Exccdisc_t* disc) if (*id) snprintf(cc->id, strlen(id) + 2, "%s_", id); sfprintf(disc->text, "\n"); - dtwalk(expr->symbols, global, cc); + dtwalk(expr->symbols, global, disc->text); } return cc; } -- 2.40.0