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
This commit is contained in:
parent
26d786331b
commit
9f6f9007b9
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user