From 730257f4c0ef0df4c30150d956dbf319c3d5aedc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Matthias=20Dieter=20Walln=C3=B6fer?= Date: Wed, 12 Oct 2011 09:29:08 +0200 Subject: [PATCH] s4:objectclass LDB module - "objectclass_add" - small optimisation This saves us from doing one "ldb_msg_find_element". Reviewed-by: abartlet --- source4/dsdb/samdb/ldb_modules/objectclass.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c index 5c89371216..6e087b9897 100644 --- a/source4/dsdb/samdb/ldb_modules/objectclass.c +++ b/source4/dsdb/samdb/ldb_modules/objectclass.c @@ -555,7 +555,8 @@ static int objectclass_do_add(struct oc_context *ac) /* We must completely replace the existing objectClass entry, * because we need it sorted. */ - ret = ldb_msg_add_empty(msg, "objectClass", 0, NULL); + ret = ldb_msg_add_empty(msg, "objectClass", 0, + &objectclass_element); if (ret != LDB_SUCCESS) { talloc_free(mem_ctx); return ret; @@ -577,9 +578,6 @@ static int objectclass_do_add(struct oc_context *ac) talloc_free(mem_ctx); - /* Retrive the message again so get_last_structural_class works */ - objectclass_element = ldb_msg_find_element(msg, "objectClass"); - /* Make sure its valid to add an object of this type */ objectclass = get_last_structural_class(ac->schema, objectclass_element, ac->req); -- 2.34.1