[Devel] refac opt_size

Igor Podlesny openvz at poige.ru
Sun Apr 28 20:31:57 PDT 2013


---
 src/lib/modules.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/lib/modules.c b/src/lib/modules.c
index c7f984f..301571e 100644
--- a/src/lib/modules.c
+++ b/src/lib/modules.c
@@ -54,13 +54,12 @@ int mod_parse(envid_t veid, struct mod_action *action, const char *name,
 	return ret;
 }
 
-static inline int opt_size(struct option *opt)
+static inline int opt_size(struct option const *opt)
 {
-	int i;
+	int i = 0;
 
-	if (opt == NULL)
-		return 0;
-	for (i = 0; opt[i].name != NULL; i++);
+	if (opt != NULL)
+		while (opt[i++].name != NULL);
 
 	return i;
 }
-- 
1.7.9.5




More information about the Devel mailing list