[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v12 01/11] change used_by: specify both driver and domain



On Mon, Feb 17, 2014 at 09:31:36AM +0100, Cedric Bosdonnat wrote:
> > diff --git a/src/util/virpci.c b/src/util/virpci.c
> > index 00d1064..4ea2bcf 100644
> > --- a/src/util/virpci.c
> > +++ b/src/util/virpci.c
> > @@ -59,7 +59,10 @@ struct _virPCIDevice {
> >      char          name[PCI_ADDR_LEN]; /* domain:bus:slot.function */
> >      char          id[PCI_ID_LEN];     /* product vendor */
> >      char          *path;
> > -    const char    *used_by;           /* The domain which uses the device */
> > +
> > +    /* The driver:domain which uses the device */
> > +    char          *used_by_drvname;
> > +    char          *used_by_domname;
> 
> Why changing from const char* to char*?

I requested this change previously. These values are passed into this
class by its callers. It is bad design practice to assume you can
keep a reference to pointers that are passed into you - they could
be free'd by the caller at any time. strdup'ing them provides a
safer API design.


Regards,
Daniel
--
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]