Junio C Hamano [off-list ref] writes:
Assuming that the shell structure is necessary around it, the code
changes in this patch looks sensible to me.
Ah, another thing. It would make more sense to do
good_example(args, struct foo *opt)
{
struct foo opt_fallback = { ... init ... };
if (!opt)
opt = &opt_fallback;
...
use opt->foo and opt->bar
}
instead of what the patch did with structure assignment, i.e.
bad_example(args, struct foo *opt_)
{
struct foo opt = { ... init ... };
if (opt_)
opt = *opt_;
...
use opt.foo and opt.bar
}
because the latter, via structure assignment, always raises "who
owns this piece of data?" question once you start adding more
complex things in the "struct foo", like a strbuf that holds the
fsck configuration data.