Author: aschnell
Date: Wed Mar 25 15:51:16 2009
New Revision: 56391
URL: http://svn.opensuse.org/viewcvs/yast?rev=56391&view=rev
Log:
- use fancy coding
- some cleanup
Modified:
trunk/storage/libstorage/src/Storage.cc
trunk/storage/libstorage/src/StorageTypes.h
Modified: trunk/storage/libstorage/src/Storage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=56391&r1=56390&r2=56391&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Wed Mar 25 15:51:16 2009
@@ -15,6 +15,7 @@
#include
#include <set>
+#include <array>
#include <fstream>
#include <sstream>
#include
@@ -3779,27 +3780,24 @@
{
int ret = 0;
y2mil("p.length:" << p.length());
- CommitStage a[] = { DECREASE, INCREASE, FORMAT, MOUNT };
- CommitStage* pt = a;
- while( unsigned(pt-a) < lengthof(a) )
- {
- bool new_pair = false;
+
+ typedef array Stages;
+ const Stages stages = { { DECREASE, INCREASE, FORMAT, MOUNT } };
+
+ for (Stages::const_iterator stage = stages.begin(); stage != stages.end(); ++stage)
+ {
list colist;
list vlist;
if (ret == 0)
{
for (ContIterator i = p.begin(); i != p.end(); ++i)
- i->getToCommit(*pt, colist, vlist);
+ i->getToCommit(*stage, colist, vlist);
}
-#if 0
- if( *pt == FORMAT && instsys() )
- {
- activateHld( true );
- }
-#endif
+
+ bool new_pair = false;
list todo;
- sortCommitLists( *pt, colist, vlist, todo );
+ sortCommitLists(*stage, colist, vlist, todo);
list::iterator ac = todo.begin();
while( ret==0 && ac != todo.end() )
{
@@ -3810,7 +3808,7 @@
if( cont )
{
bool cont_removed = co->deleted() && type==LVM;
- ret = co->commitChanges( *pt );
+ ret = co->commitChanges(*stage);
cont_removed = cont_removed && ret==0;
if( cont_removed )
{
@@ -3820,7 +3818,7 @@
}
else
{
- ret = co->commitChanges( *pt, const_cast((*ac)->vol()) );
+ ret = co->commitChanges(*stage, const_cast((*ac)->vol()));
}
if( ret!=0 )
{
@@ -3831,13 +3829,12 @@
delete( *ac );
++ac;
}
- y2mil("stage:" << *pt << " new_pair:" << new_pair);
+ y2mil("stage:" << *stage << " new_pair:" << new_pair);
if( new_pair )
{
p = cPair( fnc );
new_pair = false;
}
- pt++;
if( !todo.empty() )
{
SystemCmd c;
Modified: trunk/storage/libstorage/src/StorageTypes.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageTypes.h?rev=56391&r1=56390&r2=56391&view=diff
==============================================================================
--- trunk/storage/libstorage/src/StorageTypes.h (original)
+++ trunk/storage/libstorage/src/StorageTypes.h Wed Mar 25 15:51:16 2009
@@ -65,7 +65,8 @@
};
- typedef enum { DECREASE, INCREASE, FORMAT, MOUNT } CommitStage;
+ enum CommitStage { DECREASE, INCREASE, FORMAT, MOUNT };
+
class Volume;
class Container;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org