Date: Tue, 27 Sep 2022 21:19:14 GMT From: Doug Moore <dougm@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 9f6f9007b98f - main - name2oid: use find_oidname Message-ID: <202209272119.28RLJEHf062226@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=9f6f9007b98fc407a1b064c4492697e27954191a commit 9f6f9007b98fc407a1b064c4492697e27954191a Author: Doug Moore <dougm@FreeBSD.org> AuthorDate: 2022-09-27 21:17:55 +0000 Commit: Doug Moore <dougm@FreeBSD.org> CommitDate: 2022-09-27 21:17:55 +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 --- 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 a655e9e50677..1267ac8c9f63 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1326,17 +1326,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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202209272119.28RLJEHf062226>