summaryrefslogtreecommitdiff
path: root/source4/dsdb/schema/schema_query.c
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2010-06-19 00:00:08 +0300
committerKamen Mazdrashki <kamenim@samba.org>2010-06-21 02:57:55 +0300
commit267645ca55f7825e87a098c9dc51f132aac1f452 (patch)
tree53aed64981161a0625ffa9fcab5bd0376e470dda /source4/dsdb/schema/schema_query.c
parentecbe9a74c6757415720657fbd3ba207989b47848 (diff)
downloadsamba-267645ca55f7825e87a098c9dc51f132aac1f452.tar.gz
samba-267645ca55f7825e87a098c9dc51f132aac1f452.tar.bz2
samba-267645ca55f7825e87a098c9dc51f132aac1f452.zip
s4/dsdb-schema: Index attributes on msDS-IntId value
O(n) search for dsdb_attribute by msDS-IntId value was replaced by binary-search in ordered index. I've choosen the approach of separate index on msDS-IntId values as I think it is more clear what we are searching for. And it should little bit faster as we can clearly determine in which index to perform the search based on ATTID value - ATTIDs based on prefixMap and ATTIDs based on msDS-IntId are in separate ranges. Other way to implement this index was to merge msDS-IntId values in attributeID_id index. This led me to a shorted but not so obvious implementation.
Diffstat (limited to 'source4/dsdb/schema/schema_query.c')
-rw-r--r--source4/dsdb/schema/schema_query.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/source4/dsdb/schema/schema_query.c b/source4/dsdb/schema/schema_query.c
index 4ff84185f8..8ea79ff4bb 100644
--- a/source4/dsdb/schema/schema_query.c
+++ b/source4/dsdb/schema/schema_query.c
@@ -65,11 +65,9 @@ const struct dsdb_attribute *dsdb_attribute_by_attributeID_id(const struct dsdb_
/* check for msDS-IntId type attribute */
if (dsdb_pfm_get_attid_type(id) == dsdb_attid_type_intid) {
- for (c = schema->attributes; c; c = c->next) {
- if (c->msDS_IntId == id) {
- return c;
- }
- }
+ BINARY_ARRAY_SEARCH_P(schema->attributes_by_msDS_IntId,
+ schema->num_int_id_attr, msDS_IntId, id, uint32_cmp, c);
+ return c;
}
BINARY_ARRAY_SEARCH_P(schema->attributes_by_attributeID_id,