]> git.sur5r.net Git - openldap/commitdiff
Move BDB backend initialization to bdb_open. bdb_initialize()
authorKurt Zeilenga <kurt@openldap.org>
Mon, 11 Feb 2002 17:31:09 +0000 (17:31 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 11 Feb 2002 17:31:09 +0000 (17:31 +0000)
shouldn't do much more than register callbacks.

servers/slapd/back-bdb/init.c

index 04609b4b22018645a95e6faf10e1f318c1409376..911f23da16f54930c8f4aa68853611b174958582 100644 (file)
@@ -30,20 +30,54 @@ static struct bdbi_database {
        { NULL, NULL, 0, 0 }
 };
 
-#if 0
-static int
-bdb_destroy( BackendInfo *bi )
-{
-       return 0;
-}
-
 static int
 bdb_open( BackendInfo *bi )
 {
+       static char *controls[] = {
+               LDAP_CONTROL_MANAGEDSAIT,
+               LDAP_CONTROL_SUBENTRIES,
+               LDAP_CONTROL_NOOP,
+               NULL
+       };
+
        /* initialize the underlying database system */
        Debug( LDAP_DEBUG_TRACE, "bdb_open: initialize BDB backend\n",
                0, 0, 0 );
 
+       {       /* version check */
+               int major, minor, patch;
+               char *version = db_version( &major, &minor, &patch );
+
+               if( major != DB_VERSION_MAJOR ||
+                       minor != DB_VERSION_MINOR ||
+                       patch < DB_VERSION_PATCH )
+               {
+                       Debug( LDAP_DEBUG_ANY,
+                               "bdb_open: version mismatch\n"
+                               "\texpected: " DB_VERSION_STRING "\n"
+                               "\tgot: %s \n", version, 0, 0 );
+               }
+
+               Debug( LDAP_DEBUG_ANY, "bdb_open: %s\n",
+                       version, 0, 0 );
+       }
+
+#if 0
+       db_env_set_func_malloc( ch_malloc );
+       db_env_set_func_realloc( ch_realloc );
+       db_env_set_func_free( ch_free );
+#endif
+
+       db_env_set_func_yield( ldap_pvt_thread_yield );
+
+       bi->bi_controls = controls;
+       return 0;
+}
+
+#if 0
+static int
+bdb_destroy( BackendInfo *bi )
+{
        return 0;
 }
 
@@ -403,42 +437,7 @@ bdb_initialize(
        BackendInfo     *bi
 )
 {
-       static char *controls[] = {
-               LDAP_CONTROL_MANAGEDSAIT,
-               LDAP_CONTROL_SUBENTRIES,
-               LDAP_CONTROL_NOOP,
-               NULL
-       };
-
-       {       /* version check */
-               int major, minor, patch;
-               char *version = db_version( &major, &minor, &patch );
-
-               if( major != DB_VERSION_MAJOR ||
-                       minor != DB_VERSION_MINOR ||
-                       patch < DB_VERSION_PATCH )
-               {
-                       Debug( LDAP_DEBUG_ANY,
-                               "bi_back_initialize: version mismatch\n"
-                               "\texpected: " DB_VERSION_STRING "\n"
-                               "\tgot: %s \n", version, 0, 0 );
-               }
-
-               Debug( LDAP_DEBUG_ANY, "bdb_initialize: %s\n",
-                       version, 0, 0 );
-       }
-
-#if 0
-       db_env_set_func_malloc( ch_malloc );
-       db_env_set_func_realloc( ch_realloc );
-       db_env_set_func_free( ch_free );
-#endif
-
-       db_env_set_func_yield( ldap_pvt_thread_yield );
-
-       bi->bi_controls = controls;
-
-       bi->bi_open = 0;
+       bi->bi_open = bdb_open;
        bi->bi_close = 0;
        bi->bi_config = 0;
        bi->bi_destroy = 0;