summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common/ldb_modules.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-02-20 02:57:07 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-02-20 02:57:07 +0100
commit995788536e5ba7b3a0e67e377a9769b279d0b8ae (patch)
tree06fb578a17c9bc81e7a0c53215853f1a4c81bde4 /source4/lib/ldb/common/ldb_modules.c
parente3661a6181a7fbeffb02745adda509c01779d5ca (diff)
downloadsamba-995788536e5ba7b3a0e67e377a9769b279d0b8ae.tar.gz
samba-995788536e5ba7b3a0e67e377a9769b279d0b8ae.tar.bz2
samba-995788536e5ba7b3a0e67e377a9769b279d0b8ae.zip
Remove more function-based inits.
(This used to be commit b1a7810f3e70f9a831d9b8e85d531e448072adaf)
Diffstat (limited to 'source4/lib/ldb/common/ldb_modules.c')
-rw-r--r--source4/lib/ldb/common/ldb_modules.c66
1 files changed, 21 insertions, 45 deletions
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c
index 2dae40ddb0..7da7b9ba34 100644
--- a/source4/lib/ldb/common/ldb_modules.c
+++ b/source4/lib/ldb/common/ldb_modules.c
@@ -126,9 +126,30 @@ static struct ops_list_entry {
struct ops_list_entry *next;
} *registered_modules = NULL;
+#ifndef STATIC_LIBLDB_MODULES
+
+#define STATIC_LIBLDB_MODULES \
+ ldb_operational_module_ops, \
+ ldb_rdn_name_module_ops, \
+ ldb_paged_results_module_ops, \
+ ldb_sort_module_ops, \
+ ldb_asq_module_ops, \
+ NULL
+#endif
+
+const static struct ldb_module_ops *builtin_modules[] = {
+ STATIC_LIBLDB_MODULES
+};
+
static const struct ldb_module_ops *ldb_find_module_ops(const char *name)
{
struct ops_list_entry *e;
+ int i;
+
+ for (i = 0; builtin_modules[i]; i++) {
+ if (strcmp(builtin_modules[i]->name, name) == 0)
+ return builtin_modules[i];
+ }
for (e = registered_modules; e; e = e->next) {
if (strcmp(e->ops->name, name) == 0)
@@ -138,51 +159,6 @@ static const struct ldb_module_ops *ldb_find_module_ops(const char *name)
return NULL;
}
-#ifndef STATIC_LIBLDB_MODULES
-
-#ifdef HAVE_LDB_LDAP
-#define LDAP_INIT ldb_ldap_init,
-#else
-#define LDAP_INIT
-#endif
-
-#ifdef HAVE_LDB_SQLITE3
-#define SQLITE3_INIT ldb_sqlite3_init,
-#else
-#define SQLITE3_INIT
-#endif
-
-#define STATIC_LIBLDB_MODULES \
- LDAP_INIT \
- SQLITE3_INIT \
- ldb_tdb_init, \
- ldb_operational_init, \
- ldb_rdn_name_init, \
- ldb_paged_results_init, \
- ldb_sort_init, \
- ldb_asq_init, \
- NULL
-#endif
-
-int ldb_global_init(void)
-{
- int (*static_init_fns[])(void) = { STATIC_LIBLDB_MODULES };
-
- static int initialized = 0;
- int ret = 0, i;
-
- if (initialized)
- return 0;
-
- initialized = 1;
-
- for (i = 0; static_init_fns[i]; i++) {
- if (static_init_fns[i]() == -1)
- ret = -1;
- }
-
- return ret;
-}
int ldb_register_module(const struct ldb_module_ops *ops)
{