git: c44335b1a313 - stable/13 - name2oid: use find_oidname
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Jan 2025 11:21:33 UTC
The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=c44335b1a3137628f1b5c657c11aff1a95329085 commit c44335b1a3137628f1b5c657c11aff1a95329085 Author: Doug Moore <dougm@FreeBSD.org> AuthorDate: 2022-09-27 21:17:55 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2025-01-23 11:09:18 +0000 name2oid: use find_oidname In name2oid, use sysctl _find_oidname instead of re-implementing it. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36765 (cherry picked from commit 9f6f9007b98fc407a1b064c4492697e27954191a) --- sys/kern/kern_sysctl.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 2543c4bde785..aa9d271f3bd2 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1323,17 +1323,11 @@ name2oid(char *name, int *oid, int *len, struct sysctl_oid **oidpp) { struct sysctl_oid *oidp; struct sysctl_oid_list *lsp = &sysctl__children; - char *p; SYSCTL_ASSERT_LOCKED(); for (*len = 0; *len < CTL_MAXNAME;) { - p = strsep(&name, "."); - - SYSCTL_FOREACH(oidp, lsp) { - if (strcmp(p, oidp->oid_name) == 0) - break; - } + oidp = sysctl_find_oidname(strsep(&name, "."), lsp); if (oidp == NULL) return (ENOENT); *oid++ = oidp->oid_number;