diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-09-15 10:01:26 -0700 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-09-15 14:52:00 -0700 |
commit | e1abb39388a154b405583bd55eb4bb9c8cfa13fe (patch) | |
tree | ac6a8b6a098583a615c1062f794a4dc9776c05ff | |
parent | 4861194f39bf826f3405452adc172cf5c240715b (diff) | |
download | samba-e1abb39388a154b405583bd55eb4bb9c8cfa13fe.tar.gz samba-e1abb39388a154b405583bd55eb4bb9c8cfa13fe.tar.bz2 samba-e1abb39388a154b405583bd55eb4bb9c8cfa13fe.zip |
s4-dsdb: use DLIST_ADD() not DLIST_ADD_END()
Using DLIST_ADD_END() to construct a long list is very inefficient (it
is O(n^2). These lists are not ordered, so using DLIST_ADD() is much
better.
-rw-r--r-- | source4/dsdb/schema/schema_init.c | 4 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_set.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index 3b701ad31c..9f7d967158 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -967,7 +967,7 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, return LDB_ERR_CONSTRAINT_VIOLATION; } - DLIST_ADD_END(schema->attributes, sa, struct dsdb_attribute *); + DLIST_ADD(schema->attributes, sa); } for (i=0; i < objectclass_res->count; i++) { @@ -988,7 +988,7 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, return LDB_ERR_CONSTRAINT_VIOLATION; } - DLIST_ADD_END(schema->classes, sc, struct dsdb_class *); + DLIST_ADD(schema->classes, sc); } schema->fsmo.master_dn = ldb_msg_find_attr_as_dn(ldb, schema, schema_res->msgs[0], "fSMORoleOwner"); diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c index 6745bde127..6f09f63596 100644 --- a/source4/dsdb/schema/schema_set.c +++ b/source4/dsdb/schema/schema_set.c @@ -555,7 +555,7 @@ WERROR dsdb_set_schema_from_ldif(struct ldb_context *ldb, const char *pf, const goto failed; } - DLIST_ADD_END(schema->attributes, sa, struct dsdb_attribute *); + DLIST_ADD(schema->attributes, sa); } else if (is_sc) { struct dsdb_class *sc; @@ -569,7 +569,7 @@ WERROR dsdb_set_schema_from_ldif(struct ldb_context *ldb, const char *pf, const goto failed; } - DLIST_ADD_END(schema->classes, sc, struct dsdb_class *); + DLIST_ADD(schema->classes, sc); } } |