On Tue, 2009-12-29 at 15:08 -0200, Luiz Capitulino wrote:

> > +    class = pci_get_word(d->config + PCI_CLASS_DEVICE);
> > +    desc = pci_class_descriptions;
> > +    while (desc->desc && class != desc->class)
> > +        desc++;
> > +    if (desc->desc) {
> > +        qdict_put(qobject_to_qdict(retval), "class", 
> > qstring_from_str(desc->desc));
> > +    } else {
> > +        qdict_put(qobject_to_qdict(retval), "class", qint_from_int(class));
> > +    }
> 
>  I think it's not good to return different data types for the same key, as
> it will make clients more complex, what you can do here is to make 'class'
> a QDict with members 'desc' and 'number'.

That's reasonable. It also means we can tell clients the class number
even when the description is known, which might be useful.



Reply via email to