[Libvir] [Patch 1/4] Xen inactive domains: config file APIs

Daniel P. Berrange berrange at redhat.com
Mon Sep 4 13:36:56 UTC 2006


On Mon, Sep 04, 2006 at 04:59:58AM -0400, Daniel Veillard wrote:
> > + * virConfGetValue:
> 
>   it's SetValue :-)

Opps :-)

> 
> > + * @conf: a configuration file handle
> > + * @entry: the name of the entry
> > + * @value: the new configuration value
> > + *
> > + * Set (or replace) the value associated to this entry in the configuration
> > + * file.
> > + *
> > + * Returns 0 on success, or -1 on failure. Upon success, the passed in
> > + * value will be owned by the conf object & should not be freed. 
> 
>   Hum, it's sometimes interesting to get the previous value when doing a set
> as a result. Also the need to free only in case of error can lead to problems
> I have seen in the past similar API which returned the previous value. I
> wonder if such an API would not be more systematic, maybe it's more troubles
> than it needs to, and being jet-lag and tired it might be very wrong too :-)

Ok, I'll change it so that even in case of error, the virConfSetValue
method will free the passed in value. I think returning the old value
would unneccessarily complicate things - the caller would then have to
worry about free()ing the returned old value even though they didn't
want it in the first place! If they did want the old value it wouldn't
be much more difficult to get it via virConfGetValue ahead of time.

Regards,
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list