Optimize nl_cache_ops_associate by checking protocol early
This commit is contained in:
parent
6a7606fa29
commit
358e44efa4
|
@ -60,11 +60,14 @@ struct nl_cache_ops *nl_cache_ops_associate(int protocol, int msgtype)
|
||||||
int i;
|
int i;
|
||||||
struct nl_cache_ops *ops;
|
struct nl_cache_ops *ops;
|
||||||
|
|
||||||
for (ops = cache_ops; ops; ops = ops->co_next)
|
for (ops = cache_ops; ops; ops = ops->co_next) {
|
||||||
|
if (ops->co_protocol != protocol)
|
||||||
|
continue;
|
||||||
|
|
||||||
for (i = 0; ops->co_msgtypes[i].mt_id >= 0; i++)
|
for (i = 0; ops->co_msgtypes[i].mt_id >= 0; i++)
|
||||||
if (ops->co_msgtypes[i].mt_id == msgtype &&
|
if (ops->co_msgtypes[i].mt_id == msgtype)
|
||||||
ops->co_protocol == protocol)
|
|
||||||
return ops;
|
return ops;
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue