[Devel] [PATCH 04/10] Dont-Repeat-Yourself: refer variable only once

Igor Podlesny openvz at poige.ru
Mon May 6 23:42:06 PDT 2013


---
 src/vzctl-actions.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/vzctl-actions.c b/src/vzctl-actions.c
index e0cd261..2f7e162 100644
--- a/src/vzctl-actions.c
+++ b/src/vzctl-actions.c
@@ -1490,13 +1490,14 @@ int run_action(envid_t veid, act_t action, vps_param *g_p, vps_param *vps_p,
 		g_p->res.dq.enable = NO;
 	}
 
-	if (action != ACTION_EXEC &&
-		action != ACTION_EXEC2 &&
-		action != ACTION_EXEC3 &&
-		action != ACTION_ENTER &&
-		action != ACTION_CONSOLE &&
-		action != ACTION_STATUS)
-	{
+	switch (action) {
+	case ACTION_EXEC:	break;
+	case ACTION_EXEC2:	break;
+	case ACTION_EXEC3:	break;
+	case ACTION_ENTER:	break;
+	case ACTION_CONSOLE:	break;
+	case ACTION_STATUS:	break;
+	default:
 		if (skiplock != YES) {
 			lock_id = vps_lock(veid, g_p->opt.lockdir, "");
 			if (lock_id > 0) {
-- 
1.7.9.5




More information about the Devel mailing list