summaryrefslogtreecommitdiff
path: root/librpc/ndr
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2016-02-26 16:58:09 +1300
committerAndrew Bartlett <abartlet@samba.org>2016-03-22 08:00:31 +0100
commitc20e7b8c011d193da5e03c8bda0b0aaaf0c5a906 (patch)
treea5e543941e1b99df2f466322dd081883eaff1657 /librpc/ndr
parent59d530c0b692dae41ea271bfdb473f212615041b (diff)
downloadsamba-c20e7b8c011d193da5e03c8bda0b0aaaf0c5a906.tar.gz
ndr: inline search for ndr_token_peek()
This is often a hot path, particularly with complex structures like nt-acls. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'librpc/ndr')
-rw-r--r--librpc/ndr/ndr.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c
index b21c8fe7e83..89bacf7de5f 100644
--- a/librpc/ndr/ndr.c
+++ b/librpc/ndr/ndr.c
@@ -954,15 +954,13 @@ _PUBLIC_ enum ndr_err_code ndr_token_retrieve(struct ndr_token_list **list, cons
*/
_PUBLIC_ uint32_t ndr_token_peek(struct ndr_token_list **list, const void *key)
{
- enum ndr_err_code status;
- uint32_t v;
-
- status = ndr_token_retrieve_cmp_fn(list, key, &v, NULL, false);
- if (!NDR_ERR_CODE_IS_SUCCESS(status)) {
- return 0;
+ struct ndr_token_list *tok;
+ for (tok = *list; tok; tok = tok->next) {
+ if (tok->key == key) {
+ return tok->value;
+ }
}
-
- return v;
+ return 0;
}
/*