On Thu, May 23, 2013 at 06:14:19AM -0600, Eric Blake wrote:
> On 05/23/2013 03:08 AM, Amos Kong wrote:
> > +RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name,
> > + Error **errp)
> > +{
> > + NetClientState *nc;
> > + RxFilterInfoList *filter_list = NULL, *last_entry = NULL;
> > +
> > + QTAILQ_FOREACH(nc, &net_clients, next) {
> > + RxFilterInfoList *entry;
> > + RxFilterInfo *info;
> > +
> > + if (nc->info->type != NET_CLIENT_OPTIONS_KIND_NIC) {
> > + continue;
> > + }
> > + if (has_name && strcmp(nc->name, name) != 0) {
>
> Do you need the has_name argument here, or can you ensure that the
> caller passes NULL when the caller's has_name was false,
hmp_info_rx_filter() passes NULL name when has_name is false.
'has_name' is need here. Or we can change it to:
if (name && strcmp(nc->name, name) != 0) {
I think using 'has_name' is clearer.
> for one less parameter and the same amount of information?
qmp_query_rx_filter() define is generated by QAPI infrastructure,
the parameters are fixed. We also use it in hmp_info_rx_filter().
--
Amos.