On 08/23/2017 03:02 PM, Paolo Bonzini wrote: > On 23/08/2017 21:26, Eric Blake wrote: >>> I agree with using the short form where possible, but I disagree on >>> removing the long forms. Rather, global_qtest in my opinion should have >>> been static (though I'm not proposing that you do this); inlining the >>> wrappers is not needed for performance. >> But no one outside of libqtest.c is using the long form. Maintaining a >> long form that isn't used is counter-productive, if the short form is >> good enough for everything we need. > > Well, whatever is assigning to global_qtest should be using the long form.
Question - what about going the other way, and switching ALL callers to always use the explicit form? I'd really like to maintain only one form, but if we think maintaining the explicit form is better, then I'd rather see: s = qtest_init(...); qmp(s, "{'execute':'foo'}"); than: qtest_init(...); // implicitly sets global_test qmp("{'execute':'foo'}"); // implicitly uses global_test and not the existing: qtest_init(...); qtest_qmp(global_test, "{'execute':'foo'}"); Then, in combination with my other series to make qmp() more friendly, it would look like: s = qtest_init(...); qmp(s, "foo"); Or, put another way, I'd rather have the short name irq_intercept_in() than the long name qtest_irq_intercept_in(); but as long as we maintain only ONE set of names, then I'm okay having that one set always be explicit about passing QTestState *s as a parameter and completely getting rid of the global_test variable (rather than making it static). But whatever we decide, we'll want to stick to it, and it may require a respin - so let's get a consensus before I do any more churn on this series. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature