[sheepdog] [PATCH 1/2] collie: use do_generic_subcommind in debug module

Liu Yuan namei.unix at gmail.com
Fri Apr 19 07:54:26 CEST 2013


From: Liu Yuan <tailai.ly at taobao.com>

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 collie/debug.c  |   10 +---------
 include/event.h |    2 +-
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/collie/debug.c b/collie/debug.c
index 83dbf8f..34f2a69 100644
--- a/collie/debug.c
+++ b/collie/debug.c
@@ -201,15 +201,7 @@ static struct subcommand trace_cmd[] = {
 
 static int debug_trace(int argc, char **argv)
 {
-	int i;
-
-	for (i = 0; trace_cmd[i].name; i++) {
-		if (!strcmp(trace_cmd[i].name, argv[optind]))
-			return trace_cmd[i].fn(argc, argv);
-	}
-
-	subcommand_usage(argv[1], argv[2], EXIT_FAILURE);
-	return EXIT_FAILURE;
+	return do_generic_subcommand(trace_cmd, argc, argv);
 }
 
 static struct subcommand debug_cmd[] = {
diff --git a/include/event.h b/include/event.h
index 65277fa..8f8b21f 100644
--- a/include/event.h
+++ b/include/event.h
@@ -29,7 +29,7 @@ void add_timer(struct timer *t, unsigned int mseconds);
 
 static inline int register_event(int fd, event_handler_t h, void *data)
 {
-return register_event_prio(fd, h, data, EVENT_PRIO_DEFAULT);
+	return register_event_prio(fd, h, data, EVENT_PRIO_DEFAULT);
 }
 
 #endif
-- 
1.7.9.5




More information about the sheepdog mailing list