Paolo Bonzini <pbonz...@redhat.com> writes: > On 5/24/22 15:08, Markus Armbruster wrote: >>> -typedef void SchemaRetrieveFunc(StatsSchemaList **result, Error **errp); >>> + strList *names, strList *targets, Error >>> **errp); >>> +typedef void SchemaRetrieveFunc(StatsSchemaList **, Error **); >> >> Did you drop the parameter names intentionally? > > No, I didn't.
Easy enough to revert :) >>> + /* No names allowed is the same as skipping the >>> provider. */ >> >> Long line. >> >>> + return false; >> >> Any other elements of filter->providers that match @provider will be >> silently ignored. Is this what you want? > > Hmm, key/value pairs are ugly in QMP. Funny, considering what JSON objects are, isn't it? Ways to do maps in QMP: 1. You can always use a JSON array of objects. Any combination of members can be a key. Any semantic constaint "keys are unique" you get to enforce manually. 2. If the key is a string, you can use a JSON object. In either case, you may or may not be able to define a compile-time static schema. If you are, then 1.'s schema can be ['UnionType'], where the key is in the UnionType's base, and 2.'s can be a struct with optional members. Else, you get to play with 'any', I guess. > I'll see if I can make it work nicely without inlining > stats_provider_requested() in the caller. > >> Uh, do we leak @p_names if earlier elements matched? > > No, it's not copied so there are no leaks.