summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2022-02-11 07:25:51 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2022-02-11 07:25:51 +0000
commite75839dfecc9e81108fe8fbacfa5027ba8503741 (patch)
treef3d0ddc15db0a6dac9175ba676a2455a3f2d7d37 /sys
parentb6552dcdb2a7974ee29716429d51abdf77ba934c (diff)
Inline klist_empty() for more economic machine code.
OK mpi@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_event.c8
-rw-r--r--sys/sys/event.h9
2 files changed, 8 insertions, 9 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index 0c651ee6076..25a438f7709 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_event.c,v 1.179 2022/02/08 08:56:41 visa Exp $ */
+/* $OpenBSD: kern_event.c,v 1.180 2022/02/11 07:25:50 visa Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@@ -2095,12 +2095,6 @@ klist_remove_locked(struct klist *klist, struct knote *kn)
SLIST_REMOVE(&klist->kl_list, kn, knote, kn_selnext);
}
-int
-klist_empty(struct klist *klist)
-{
- return (SLIST_EMPTY(&klist->kl_list));
-}
-
/*
* Detach all knotes from klist. The knotes are rewired to indicate EOF.
*
diff --git a/sys/sys/event.h b/sys/sys/event.h
index 4a864343132..76272cc0280 100644
--- a/sys/sys/event.h
+++ b/sys/sys/event.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: event.h,v 1.62 2022/02/08 08:56:41 visa Exp $ */
+/* $OpenBSD: event.h,v 1.63 2022/02/11 07:25:50 visa Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@@ -314,9 +314,14 @@ extern void klist_insert(struct klist *, struct knote *);
extern void klist_insert_locked(struct klist *, struct knote *);
extern void klist_remove(struct klist *, struct knote *);
extern void klist_remove_locked(struct klist *, struct knote *);
-extern int klist_empty(struct klist *);
extern void klist_invalidate(struct klist *);
+static inline int
+klist_empty(struct klist *klist)
+{
+ return (SLIST_EMPTY(&klist->kl_list));
+}
+
#else /* !_KERNEL */
#include <sys/cdefs.h>