All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch 3/8] CLD: cleanup: if() to switch()
@ 2010-04-14 18:34 Pete Zaitcev
  0 siblings, 0 replies; only message in thread
From: Pete Zaitcev @ 2010-04-14 18:34 UTC (permalink / raw)
  To: jeff; +Cc: Project Hail List

I distinctly remember how my precious ifs were mercilessly replaced
elsewhere, but apparently this piece escaped notice thus far.
Now, make it more style-uniform with the rest.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>

---
 lib/cldc.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/cldc.c b/lib/cldc.c
index be8598f..305e05d 100644
--- a/lib/cldc.c
+++ b/lib/cldc.c
@@ -1386,10 +1388,12 @@ static void ncld_thread_command(struct ncld_sess *nsess)
 		abort();
 	}
 
-	if (cmd == NCLD_CMD_END) {
+	switch (cmd) {
+	case NCLD_CMD_END:
 		/* No answer to requestor. Wait with g_thread_join. */
 		g_thread_exit(NULL);
-	} else if (cmd == NCLD_CMD_SESEV) {
+		break;
+	case NCLD_CMD_SESEV:
 		rrc = read(nsess->to_thread[0], &what, sizeof(uint32_t));
 		if (rrc < sizeof(uint32_t)) {
 			fprintf(stderr, "bad read param\n");
@@ -1397,7 +1401,8 @@ static void ncld_thread_command(struct ncld_sess *nsess)
 		}
 		if (nsess->event)
 			nsess->event(nsess->event_arg, what);
-	} else {
+		break;
+	default:
 		fprintf(stderr, "bad command 0x%x\n", cmd);
 		abort();
 	}

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-04-14 18:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-14 18:34 [Patch 3/8] CLD: cleanup: if() to switch() Pete Zaitcev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.