summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2008-11-21 08:21:06 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2008-11-21 08:21:06 +0000
commit85f70ed89d6ca1ce6cd67c56ad576af20d87602b (patch)
tree077535f6cad131191e11419d3bf0cdb042e790fa
parentf3e416cd3ea338c811d1778fa9ccbe7ef2ecd4e6 (diff)
downloadlibapr-util-85f70ed89d6ca1ce6cd67c56ad576af20d87602b.tar.gz
Assorted corrections and bug fixes I had missed, as Unix
was picking up an odd path through the dbm source files. Tests now pass (linux x86 for sdbm/gdbm/db4). git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@719533 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--dbm/apr_dbm.c37
-rw-r--r--dbm/apr_dbm_berkeleydb.c1
-rw-r--r--dbm/apr_dbm_gdbm.c1
-rw-r--r--dbm/apr_dbm_ndbm.c1
-rw-r--r--dbm/apr_dbm_sdbm.c3
-rw-r--r--include/private/apr_dbm_private.h12
6 files changed, 31 insertions, 24 deletions
diff --git a/dbm/apr_dbm.c b/dbm/apr_dbm.c
index 301310ef..613d0fe1 100644
--- a/dbm/apr_dbm.c
+++ b/dbm/apr_dbm.c
@@ -15,6 +15,8 @@
*/
#include "apr.h"
+#include "apr_dso.h"
+#include "apr_hash.h"
#include "apr_errno.h"
#include "apr_pools.h"
#include "apr_strings.h"
@@ -23,7 +25,10 @@
#include "apr_want.h"
#include "apr_general.h"
+#include "apu_config.h"
#include "apu.h"
+#include "apu_internal.h"
+#include "apu_version.h"
#include "apr_dbm_private.h"
#include "apu_select_dbm.h"
#include "apr_dbm.h"
@@ -55,7 +60,7 @@
static apr_hash_t *drivers = NULL;
-static apr_status_t apr_dbd_term(void *ptr)
+static apr_status_t dbm_term(void *ptr)
{
/* set drivers to NULL so init can work again */
drivers = NULL;
@@ -81,13 +86,13 @@ static apr_status_t dbm_open_type(apr_dbm_type_t const* * vtable,
#endif
else if (*type && !strcasecmp(type + 1, "dbm")) {
#if APU_HAVE_GDBM
- if (*type == 'G' && *type == 'g') *vtable = &apr_dbm_type_gdbm;
+ if (*type == 'G' || *type == 'g') *vtable = &apr_dbm_type_gdbm;
#endif
#if APU_HAVE_NDBM
- if (*type == 'N' && *type == 'n') *vtable = &apr_dbm_type_ndbm;
+ if (*type == 'N' || *type == 'n') *vtable = &apr_dbm_type_ndbm;
#endif
#if APU_HAVE_SDBM
- if (*type == 'S' && *type == 's') *vtable = &apr_dbm_type_sdbm;
+ if (*type == 'S' || *type == 's') *vtable = &apr_dbm_type_sdbm;
#endif
/* avoid empty block */ ;
}
@@ -106,34 +111,33 @@ static apr_status_t dbm_open_type(apr_dbm_type_t const* * vtable,
if (!strcasecmp(type, "default")) type = DBM_NAME;
else if (!strcasecmp(type, "db")) type = "db";
else if (*type && !strcasecmp(type + 1, "dbm")) {
- if (type == 'G' || type == 'g') type = "gdbm";
- else if (type == 'N' || type == 'n') type = "ndbm";
- else if (type == 'S' || type == 's') type = "sdbm";
+ if (*type == 'G' || *type == 'g') type = "gdbm";
+ else if (*type == 'N' || *type == 'n') type = "ndbm";
+ else if (*type == 'S' || *type == 's') type = "sdbm";
}
else usertype = 1;
if (!drivers)
{
- apr_pool_t *ppool = pool;
apr_pool_t *parent;
/* Top level pool scope, need process-scope lifetime */
- for (parent = pool; parent; parent = apr_pool_parent_get(ppool))
- ppool = parent;
+ for (parent = pool; parent; parent = apr_pool_parent_get(pool))
+ pool = parent;
/* deprecate in 2.0 - permit implicit initialization */
- apu_dso_init(ppool);
+ apu_dso_init(pool);
- drivers = apr_hash_make(ppool);
+ drivers = apr_hash_make(pool);
apr_hash_set(drivers, "sdbm", APR_HASH_KEY_STRING, &apr_dbm_type_sdbm);
- apr_pool_cleanup_register(ppool, NULL, dbm_term,
+ apr_pool_cleanup_register(pool, NULL, dbm_term,
apr_pool_cleanup_null);
}
rv = apu_dso_mutex_lock();
if (rv) {
- *vtable = NULL
+ *vtable = NULL;
return rv;
}
@@ -158,12 +162,13 @@ static apr_status_t dbm_open_type(apr_dbm_type_t const* * vtable,
#endif
apr_snprintf(symname, sizeof(symname), "apr_dbm_type_%s", type);
- rv = apu_dso_load(&symbol, modname, symname, pool);
- if (rv != APR_SUCCESS || rv == APR_EINIT) { /* previously loaded?!? */
+ rv = apu_dso_load(NULL, &symbol, modname, symname, pool);
+ if (rv == APR_SUCCESS || rv == APR_EINIT) { /* previously loaded?!? */
*vtable = symbol;
if (usertype)
type = apr_pstrdup(pool, type);
apr_hash_set(drivers, type, APR_HASH_KEY_STRING, *vtable);
+ rv = APR_SUCCESS;
}
else
*vtable = NULL;
diff --git a/dbm/apr_dbm_berkeleydb.c b/dbm/apr_dbm_berkeleydb.c
index 00b47467..0cbab82b 100644
--- a/dbm/apr_dbm_berkeleydb.c
+++ b/dbm/apr_dbm_berkeleydb.c
@@ -25,6 +25,7 @@
#include <stdlib.h> /* for abort() */
#endif
+#include "apu_config.h"
#include "apu.h"
#if APU_HAVE_DB
diff --git a/dbm/apr_dbm_gdbm.c b/dbm/apr_dbm_gdbm.c
index 87c0ac72..749447a0 100644
--- a/dbm/apr_dbm_gdbm.c
+++ b/dbm/apr_dbm_gdbm.c
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include "apu_config.h"
#include "apu.h"
#include "apr_strings.h"
diff --git a/dbm/apr_dbm_ndbm.c b/dbm/apr_dbm_ndbm.c
index db6eec1f..7f381862 100644
--- a/dbm/apr_dbm_ndbm.c
+++ b/dbm/apr_dbm_ndbm.c
@@ -20,6 +20,7 @@
#include <stdlib.h> /* for free() */
#endif
+#include "apu_config.h"
#include "apu.h"
#if APU_HAVE_NDBM
diff --git a/dbm/apr_dbm_sdbm.c b/dbm/apr_dbm_sdbm.c
index 032c08cd..6f531a17 100644
--- a/dbm/apr_dbm_sdbm.c
+++ b/dbm/apr_dbm_sdbm.c
@@ -19,6 +19,7 @@
#define APR_WANT_STRFUNC
#include "apr_want.h"
+#include "apu_config.h"
#include "apu.h"
#if APU_HAVE_SDBM
@@ -206,7 +207,7 @@ static void vt_sdbm_usednames(apr_pool_t *pool, const char *pathname,
*used2 = apr_pstrcat(pool, pathname, APR_SDBM_PAGFEXT, NULL);
}
-APU_DECLARE_DATA const apr_dbm_type_t apr_dbm_type_sdbm = {
+APU_MODULE_DECLARE_DATA const apr_dbm_type_t apr_dbm_type_sdbm = {
"sdbm",
vt_sdbm_open,
vt_sdbm_close,
diff --git a/include/private/apr_dbm_private.h b/include/private/apr_dbm_private.h
index 1c23c13d..020d3a6b 100644
--- a/include/private/apr_dbm_private.h
+++ b/include/private/apr_dbm_private.h
@@ -108,13 +108,11 @@ struct apr_dbm_t
};
-/* Declare all of the builtin DBM providers */
-APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_sdbm;
-#if !APU_DSO_BUILD
-APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_gdbm;
-APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_ndbm;
-APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db;
-#endif
+/* Declare all of the DBM provider tables */
+APU_MODULE_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_sdbm;
+APU_MODULE_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_gdbm;
+APU_MODULE_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_ndbm;
+APU_MODULE_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db;
#ifdef __cplusplus
}