This reduces copy-paste amount and reduces typos chances.
---
 src/lib/dist.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/lib/dist.c b/src/lib/dist.c
index 2b7fdf3..1ab263d 100644
--- a/src/lib/dist.c
+++ b/src/lib/dist.c
@@ -30,13 +30,15 @@ static struct distr_conf {
        char *name;
        int id;
 } action2id[] = {
-       {"ADD_IP", ADD_IP},
-       {"DEL_IP", DEL_IP},
-       {"SET_HOSTNAME", SET_HOSTNAME},
-       {"SET_DNS", SET_DNS},
-       {"SET_USERPASS", SET_USERPASS},
-       {"SET_UGID_QUOTA", SET_UGID_QUOTA},
-       {"POST_CREATE", POST_CREATE}
+#define ACT2ID(actid) { #actid, actid }
+       ACT2ID(ADD_IP),
+       ACT2ID(DEL_IP),
+       ACT2ID(SET_HOSTNAME),
+       ACT2ID(SET_DNS),
+       ACT2ID(SET_USERPASS),
+       ACT2ID(SET_UGID_QUOTA),
+       ACT2ID(POST_CREATE)
+#undef ACT2ID
 };
 
 static int get_action_id(char *name)
-- 
1.7.9.5

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to