From: Matthew Fernandez Date: Fri, 5 Aug 2022 01:41:06 +0000 (-0700) Subject: expr exccopen: only pass SFIO stream to callback X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3fe831fc7a3d5b89487918d74419c40a5c2e2f70;p=graphviz 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`. --- 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; }