Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpuffs use a switch.



details:   https://anonhg.NetBSD.org/src/rev/0db6e53f6573
branches:  trunk
changeset: 323773:0db6e53f6573
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jun 30 16:05:44 2018 +0000

description:
use a switch.

diffstat:

 lib/libpuffs/puffs.c |  20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diffs (49 lines):

diff -r 58f6db5e5e79 -r 0db6e53f6573 lib/libpuffs/puffs.c
--- a/lib/libpuffs/puffs.c      Sat Jun 30 15:08:04 2018 +0000
+++ b/lib/libpuffs/puffs.c      Sat Jun 30 16:05:44 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs.c,v 1.123 2018/02/08 09:05:17 dholland Exp $     */
+/*     $NetBSD: puffs.c,v 1.124 2018/06/30 16:05:44 christos Exp $     */
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: puffs.c,v 1.123 2018/02/08 09:05:17 dholland Exp $");
+__RCSID("$NetBSD: puffs.c,v 1.124 2018/06/30 16:05:44 christos Exp $");
 #endif /* !lint */
 
 #include <sys/param.h>
@@ -904,21 +904,23 @@
                        }
 
                        what = 0;
-                       if (curev->filter == EVFILT_READ) {
+                       switch (curev->filter) {
+                       case EVFILT_READ:
                                puffs__framev_input(pu, pfctrl, fio);
                                what |= PUFFS_FBIO_READ;
-                       }
-
-                       else if (curev->filter == EVFILT_WRITE) {
+                               break;
+                       case EVFILT_WRITE:
                                puffs__framev_output(pu, pfctrl, fio);
                                what |= PUFFS_FBIO_WRITE;
-                       }
-
-                       else if (__predict_false(curev->filter==EVFILT_SIGNAL)){
+                               break;
+                       case EVFILT_SIGNAL:
                                if ((pu->pu_state & PU_DONEXIT) == 0) {
                                        PU_SETSFLAG(pu, PU_DONEXIT);
                                        puffs_exit(pu, 0);
                                }
+                               break;
+                       default:
+                               warn("unhandled filter %d", curev->filter);
                        }
                        if (what)
                                puffs__framev_notify(fio, what);



Home | Main Index | Thread Index | Old Index