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

Re: [lvm-devel] [PATCH 1/2] lvm2app: Add function to retrieve the origin.

Dne 12.4.2013 17:44, Tony Asleson napsal(a):
On 04/12/2013 03:22 AM, Zdenek Kabelac wrote:
If you need just 'const' pointer - it would be probably better,
to directly return the name - instead of duplication.


i.e. lv_origin_dup() ->  rewrite to  'const char *lv_get_origin(.)' ->
and use it for  lv_name_dup() in lv_origin_dup() which returns char *.
as well as for  lvm_lv_get_origin().

I ran into at least 2 different implementations of *get_origin.  There
is lv_origin_dup() and _origin_disp.  Both utilize the same logic with
slightly different output.  I haven't looked around it see if there are

To clean this up correctly I would want to write what you are suggesting
and then use it in all the different places.

Yep, that would be very useful - since we already do a tons of useless string duplication - we should try to avoid a new set of those ;)

There are many more places, where we could be happy with just const reference,
since the lifetime of object is clearly defined and parent object cannot be removed/changed, so there is no benefit of using duplicate copies.



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