Pass constant string by reference to lvm2_pv_size_to_num()
It is common C++ practice to pass a constant object by reference to avoid constructing a duplicate object for pass by value [1]. [1] How to pass objects to functions in C++? https://stackoverflow.com/questions/2139224/how-to-pass-objects-to-functions-in-c/2139254#2139254
This commit is contained in:
parent
c0a7aa438a
commit
a41e8b03ec
|
@ -69,7 +69,7 @@ private:
|
|||
static void load_lvm2_pv_info_cache();
|
||||
static const LVM2_PV & get_pv_cache_entry_by_name( const Glib::ustring & pvname );
|
||||
static const LVM2_VG & get_vg_cache_entry_by_name( const Glib::ustring & vgname );
|
||||
static Byte_Value lvm2_pv_size_to_num( const Glib::ustring str ) ;
|
||||
static Byte_Value lvm2_pv_size_to_num(const Glib::ustring& str);
|
||||
static bool bit_set( const Glib::ustring & attr, unsigned int bit ) ;
|
||||
static bool lvm2_pv_info_cache_initialized ;
|
||||
static bool lvm_found ;
|
||||
|
|
|
@ -358,9 +358,10 @@ const LVM2_VG & LVM2_PV_Info::get_vg_cache_entry_by_name( const Glib::ustring &
|
|||
return vg;
|
||||
}
|
||||
|
||||
//Return string converted to a number, or -1 for error.
|
||||
//Used to convert PVs size or free bytes.
|
||||
Byte_Value LVM2_PV_Info::lvm2_pv_size_to_num( const Glib::ustring str )
|
||||
|
||||
// Return string converted to a number, or -1 for error.
|
||||
// Used to convert PVs size or free bytes.
|
||||
Byte_Value LVM2_PV_Info::lvm2_pv_size_to_num(const Glib::ustring& str)
|
||||
{
|
||||
Byte_Value num = -1 ;
|
||||
if ( str != "" )
|
||||
|
|
Loading…
Reference in New Issue