Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/include/linux match_string
details: https://anonhg.NetBSD.org/src/rev/69f5c652f98a
branches: trunk
changeset: 1028357:69f5c652f98a
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 10:48:00 2021 +0000
description:
match_string
diffstat:
sys/external/bsd/drm2/include/linux/string.h | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diffs (30 lines):
diff -r d1d5372321ac -r 69f5c652f98a sys/external/bsd/drm2/include/linux/string.h
--- a/sys/external/bsd/drm2/include/linux/string.h Sun Dec 19 10:47:54 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/string.h Sun Dec 19 10:48:00 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: string.h,v 1.8 2021/12/19 09:51:20 riastradh Exp $ */
+/* $NetBSD: string.h,v 1.9 2021/12/19 10:48:00 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -133,4 +133,20 @@
#define str_has_prefix(str, prefix) strncmp(str, prefix, strlen(prefix))
+static inline int
+match_string(const char *const *haystack, size_t n, const char *needle)
+{
+ int i;
+
+ for (i = 0; i < n; i++) {
+ if (haystack[i] == NULL)
+ break;
+ if (strcmp(haystack[i], needle) == 0)
+ return i;
+ if (i == INT_MAX)
+ break;
+ }
+ return -EINVAL;
+}
+
#endif /* _LINUX_STRING_H_ */
Home |
Main Index |
Thread Index |
Old Index