Author: aschnell
Date: Wed Jan 7 16:16:47 2009
New Revision: 54439
URL: http://svn.opensuse.org/viewcvs/yast?rev=54439&view=rev
Log:
- use list::remove_if instead of handmade stuff
Modified:
trunk/storage/libstorage/src/DmPart.cc
trunk/storage/libstorage/src/Partition.cc
trunk/storage/libstorage/src/Volume.cc
Modified: trunk/storage/libstorage/src/DmPart.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/DmPart.cc?rev=54439&r1=54438&r2=54439&view=diff
==============================================================================
--- trunk/storage/libstorage/src/DmPart.cc (original)
+++ trunk/storage/libstorage/src/DmPart.cc Wed Jan 7 16:16:47 2009
@@ -109,14 +109,8 @@
void
DmPart::addAltUdevId( unsigned num )
{
- list<string>::iterator i = alt_names.begin();
- while( i!=alt_names.end() )
- {
- if( i->find( "/by-id/" ) != string::npos )
- i = alt_names.erase( i );
- else
- ++i;
- }
+ alt_names.remove_if(find_any("/by-id/"));
+
list<string>::const_iterator j = co()->udevId().begin();
while( j!=co()->udevId().end() )
{
Modified: trunk/storage/libstorage/src/Partition.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Partition.cc?rev=54439&r1=54438&r2=54439&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Partition.cc (original)
+++ trunk/storage/libstorage/src/Partition.cc Wed Jan 7 16:16:47 2009
@@ -119,16 +119,11 @@
" orig:" << mbyTypeString(orig_mount_by) );
}
+
void Partition::addAltUdevId( unsigned num )
{
- list<string>::iterator i = alt_names.begin();
- while( i!=alt_names.end() )
- {
- if( i->find( "/by-id/" ) != string::npos )
- i = alt_names.erase( i );
- else
- ++i;
- }
+ alt_names.remove_if(find_any("/by-id/"));
+
list<string>::const_iterator j = disk()->udevId().begin();
while( j!=disk()->udevId().end() )
{
@@ -137,20 +132,16 @@
}
}
+
void Partition::addAltUdevPath( unsigned num )
{
- list<string>::iterator i = alt_names.begin();
- while( i!=alt_names.end() )
- {
- if( i->find( "/by-path/" ) != string::npos )
- i = alt_names.erase( i );
- else
- ++i;
- }
+ alt_names.remove_if(find_any("/by-path/"));
+
if( !disk()->udevPath().empty() )
alt_names.push_back( udevCompletePathPath( disk()->udevPath(), num ));
}
+
void Partition::changeNumber( unsigned new_num )
{
if( new_num!=num )
Modified: trunk/storage/libstorage/src/Volume.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Volume.cc?rev=54439&r1=54438&r2=54439&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Volume.cc (original)
+++ trunk/storage/libstorage/src/Volume.cc Wed Jan 7 16:16:47 2009
@@ -460,13 +460,7 @@
{
uuid = i->second;
b << " uuid:" << uuid;
- list<string>::iterator i = find_if( alt_names.begin(),
- alt_names.end(),
- find_any( "/by-uuid/" ) );
- if( i!=alt_names.end() )
- {
- alt_names.erase(i);
- }
+ alt_names.remove_if(find_any("/by-uuid/"));
alt_names.push_back( "/dev/disk/by-uuid/" + uuid );
}
i = m.find( "LABEL" );
@@ -476,13 +470,7 @@
if (fs != HFS)
label = orig_label = i->second;
b << " label:\"" << label << "\"";
- list<string>::iterator i = find_if( alt_names.begin(),
- alt_names.end(),
- find_any( "/by-label/" ) );
- if( i!=alt_names.end() )
- {
- alt_names.erase(i);
- }
+ alt_names.remove_if(find_any("/by-label/"));
alt_names.push_back( "/dev/disk/by-label/" + label );
}
y2mil(b.str());
@@ -2147,10 +2135,9 @@
list<string> l = splitString( fstab_opt, "," );
y2mil( "l before:" << l );
for( unsigned i=0; i