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

Re: [lvm-devel] LVM2/liblvm lvm2app.h lvm_lv.c lvm_pv.c lvm_vg.c



On 19.4.2010 19:06, Alasdair G Kergon wrote:
> On Mon, Apr 19, 2010 at 05:34:04PM +0200, Zdenek Kabelac wrote:
>> Either we should return   const char*  return vg->name;
> 
> But then we have to guarantee that vg->name remains const - which we are
> unable to do.  (We can't impose limits on vgrename.)
> 

I think we may state, that until next call of any lvm library function pointer
remains valid. Thus if user needs it for something later - he needs to make a
local copy.

We may be nicer if we list functions which could change this pointer (i.e. I
wouldn't expect any *_get_* function could ever change it) - but I think it's
not needed - major use case would be to check value for something
and eventually copy somewhere - thus const char* is perfectly usable in this
case. So I think any const char* is valid between lvm calls - and if they are
valid after - it's just pure luck....

Zdenek


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