From: Andrew Bartlett Date: Thu, 11 Apr 2019 23:26:01 +0000 (+1200) Subject: ldb: Avoid calling talloc_get_type() in ldb_kv_parse_data_unpack() X-Git-Tag: tdb-1.4.1~444 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=075a078d3655e4101021f47842b56d2dc755d092;p=thirdparty%2Fsamba.git ldb: Avoid calling talloc_get_type() in ldb_kv_parse_data_unpack() We have the ldb_kv in the caller, just fill it into the context and so avoid the cost of the talloc_get_type(). Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam --- diff --git a/lib/ldb/ldb_key_value/ldb_kv_search.c b/lib/ldb/ldb_key_value/ldb_kv_search.c index a2946d6506b..a7e532e41ac 100644 --- a/lib/ldb/ldb_key_value/ldb_kv_search.c +++ b/lib/ldb/ldb_key_value/ldb_kv_search.c @@ -177,6 +177,7 @@ int ldb_kv_search_base(struct ldb_module *module, struct ldb_kv_parse_data_unpack_ctx { struct ldb_message *msg; struct ldb_module *module; + struct ldb_kv_private *ldb_kv; unsigned int unpack_flags; }; @@ -190,8 +191,7 @@ static int ldb_kv_parse_data_unpack(struct ldb_val key, struct ldb_context *ldb = ldb_module_get_ctx(ctx->module); struct ldb_val data_parse = data; - struct ldb_kv_private *ldb_kv = - talloc_get_type(ldb_module_get_private(ctx->module), struct ldb_kv_private); + struct ldb_kv_private *ldb_kv = ctx->ldb_kv; if ((ctx->unpack_flags & LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC)) { if ((ldb_kv->kv_ops->options & LDB_KV_OPTION_STABLE_READ_LOCK) && @@ -266,7 +266,8 @@ int ldb_kv_search_key(struct ldb_module *module, struct ldb_kv_parse_data_unpack_ctx ctx = { .msg = msg, .module = module, - .unpack_flags = unpack_flags + .unpack_flags = unpack_flags, + .ldb_kv = ldb_kv }; memset(msg, 0, sizeof(*msg));