summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2013-01-21 22:27:10 -0800
committerAndrew Bartlett <abartlet@samba.org>2013-05-20 21:52:38 +1000
commitcd7f3fd07215a7b8372b6b623faed02ae1310cb1 (patch)
treec06cc7b4ff7864d7906056d59abc8875a16677bf /source4
parent61a2ad3c020424cead067cbdc89ea6f25708fde4 (diff)
downloadsamba-cd7f3fd07215a7b8372b6b623faed02ae1310cb1.tar.gz
dsdb-schema: remove looping on all schema classes for system_possible_inferrior
The logic to populate possible inferriors and system possible inferriors is the same so instead of looping twice we do both attributes (depending on the type of the class) in the same loop Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/schema/schema_inferiors.c53
1 files changed, 19 insertions, 34 deletions
diff --git a/source4/dsdb/schema/schema_inferiors.c b/source4/dsdb/schema/schema_inferiors.c
index 2f7d46131b4..4d095216742 100644
--- a/source4/dsdb/schema/schema_inferiors.c
+++ b/source4/dsdb/schema/schema_inferiors.c
@@ -201,45 +201,31 @@ static void schema_fill_possible_inferiors(const struct dsdb_schema *schema,
struct dsdb_class *schema_class)
{
struct dsdb_class *c2;
+ const char** poss_inf = schema_class->possibleInferiors;
+ const char** sys_poss_inf = schema_class->systemPossibleInferiors;
- schema_class->possibleInferiors = NULL;
-
- for (c2=schema->classes; c2; c2=c2->next) {
+ for (c2 = schema->classes; c2; c2 = c2->next) {
const char **superiors = schema_posssuperiors(schema, c2);
- if (c2->systemOnly == false
- && c2->objectClassCategory != 2
- && c2->objectClassCategory != 3
- && str_list_check(superiors, schema_class->lDAPDisplayName)) {
- if (schema_class->possibleInferiors == NULL) {
- schema_class->possibleInferiors = const_str_list(str_list_make_empty(schema_class));
+ if (c2->objectClassCategory != 2 &&
+ c2->objectClassCategory != 3 &&
+ str_list_check(superiors, schema_class->lDAPDisplayName))
+ {
+ if (c2->systemOnly == false) {
+ if (poss_inf == NULL) {
+ poss_inf = const_str_list(str_list_make_empty(schema_class));
+ }
+ poss_inf = str_list_add_const(poss_inf,
+ c2->lDAPDisplayName);
}
- schema_class->possibleInferiors = str_list_add_const(schema_class->possibleInferiors,
- c2->lDAPDisplayName);
- }
- }
- schema_class->possibleInferiors = str_list_unique(schema_class->possibleInferiors);
-}
-
-static void schema_fill_system_possible_inferiors(const struct dsdb_schema *schema,
- struct dsdb_class *schema_class)
-{
- struct dsdb_class *c2;
-
- schema_class->systemPossibleInferiors = NULL;
-
- for (c2=schema->classes; c2; c2=c2->next) {
- const char **superiors = schema_posssuperiors(schema, c2);
- if (c2->objectClassCategory != 2
- && c2->objectClassCategory != 3
- && str_list_check(superiors, schema_class->lDAPDisplayName)) {
- if (schema_class->systemPossibleInferiors == NULL) {
- schema_class->systemPossibleInferiors = const_str_list(str_list_make_empty(schema_class));
+ if (sys_poss_inf == NULL) {
+ sys_poss_inf = const_str_list(str_list_make_empty(schema_class));
}
- schema_class->systemPossibleInferiors = str_list_add_const(schema_class->systemPossibleInferiors,
- c2->lDAPDisplayName);
+ sys_poss_inf = str_list_add_const(sys_poss_inf,
+ c2->lDAPDisplayName);
}
}
- schema_class->systemPossibleInferiors = str_list_unique(schema_class->systemPossibleInferiors);
+ schema_class->systemPossibleInferiors = str_list_unique(sys_poss_inf);
+ schema_class->possibleInferiors = str_list_unique(poss_inf);
}
/*
@@ -347,7 +333,6 @@ int schema_fill_constructed(const struct dsdb_schema *schema)
for (schema_class=schema->classes; schema_class; schema_class=schema_class->next) {
schema_fill_possible_inferiors(schema, schema_class);
- schema_fill_system_possible_inferiors(schema, schema_class);
}
/* free up our internal cache elements */