diff options
author | Nick Kew <niq@apache.org> | 2009-08-21 21:40:17 +0200 |
---|---|---|
committer | Nick Kew <niq@apache.org> | 2009-08-21 21:40:17 +0200 |
commit | fadce7cbefb2279b1a51b2a0046c91f3f1f728c2 (patch) | |
tree | 2d2e3914694633b7e81cf1f86daede6eafa0e301 | |
parent | fix wrong name in function prototype which led to (diff) | |
download | apache2-fadce7cbefb2279b1a51b2a0046c91f3f1f728c2.tar.xz apache2-fadce7cbefb2279b1a51b2a0046c91f3f1f728c2.zip |
Switch mod_dbd to using APR_STATUS_IS_foo macros in error handling
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@806692 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | modules/database/mod_dbd.c | 28 | ||||
-rw-r--r-- | modules/database/mod_dbd.h | 2 |
2 files changed, 15 insertions, 15 deletions
diff --git a/modules/database/mod_dbd.c b/modules/database/mod_dbd.c index d487a585c1..106a9c1119 100644 --- a/modules/database/mod_dbd.c +++ b/modules/database/mod_dbd.c @@ -160,6 +160,7 @@ static void ap_dbd_sql_init(server_rec *s, const char *query) static const char *dbd_param(cmd_parms *cmd, void *dconf, const char *val) { + apr_status_t rv; const apr_dbd_driver_t *driver = NULL; svr_cfg *svr = ap_get_module_config(cmd->server->module_config, &dbd_module); @@ -172,10 +173,11 @@ static const char *dbd_param(cmd_parms *cmd, void *dconf, const char *val) * best done at server startup. This also guarantees that * we won't return an error later. */ - switch (apr_dbd_get_driver(cmd->pool, cfg->name, &driver)) { - case APR_ENOTIMPL: + rv = apr_dbd_get_driver(cmd->pool, cfg->name, &driver); + if (APR_STATUS_IS_ENOTIMPL(rv)) { return apr_psprintf(cmd->pool, "DBD: No driver for %s", cfg->name); - case APR_EDSOOPEN: + } + else if (APR_STATUS_IS_EDSOOPEN(rv)) { return apr_psprintf(cmd->pool, #ifdef NETWARE "DBD: Can't load driver file dbd%s.nlm", @@ -183,7 +185,8 @@ static const char *dbd_param(cmd_parms *cmd, void *dconf, const char *val) "DBD: Can't load driver file apr_dbd_%s.so", #endif cfg->name); - case APR_ESYMNOTFOUND: + } + else if (APR_STATUS_IS_ESYMNOTFOUND(rv)) { return apr_psprintf(cmd->pool, "DBD: Failed to load driver apr_dbd_%s_driver", cfg->name); @@ -535,26 +538,23 @@ static apr_status_t dbd_construct(void **data_ptr, */ rv = apr_dbd_get_driver(rec->pool, cfg->name, &rec->driver); if (rv != APR_SUCCESS) { - switch (rv) { - case APR_ENOTIMPL: + if (APR_STATUS_IS_ENOTIMPL(rv)) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, cfg->server, "DBD: driver for %s not available", cfg->name); - break; - case APR_EDSOOPEN: + } + else if (APR_STATUS_IS_EDSOOPEN(rv)) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, cfg->server, "DBD: can't find driver for %s", cfg->name); - break; - case APR_ESYMNOTFOUND: + } + else if (APR_STATUS_IS_ESYMNOTFOUND(rv)) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, cfg->server, "DBD: driver for %s is invalid or corrupted", cfg->name); - break; - default: + } + else { ap_log_error(APLOG_MARK, APLOG_ERR, rv, cfg->server, "DBD: mod_dbd not compatible with APR in get_driver"); - break; } - apr_pool_destroy(rec->pool); return rv; } diff --git a/modules/database/mod_dbd.h b/modules/database/mod_dbd.h index fbad740121..c1ee768b73 100644 --- a/modules/database/mod_dbd.h +++ b/modules/database/mod_dbd.h @@ -116,7 +116,7 @@ APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_cacquire, (conn_rec*)); APR_DECLARE_OPTIONAL_FN(void, ap_dbd_prepare, (server_rec*, const char*, const char*)); APR_DECLARE_EXTERNAL_HOOK(dbd, DBD, apr_status_t, post_connect, - (apr_pool_t *, dbd_cfg_t *, ap_dbd_t *)); + (apr_pool_t *, dbd_cfg_t *, ap_dbd_t *)) #endif /** @} */ |