httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chr...@apache.org
Subject svn commit: r646453 - in /httpd/httpd/trunk: CHANGES modules/database/mod_dbd.c
Date Wed, 09 Apr 2008 18:01:54 GMT
Author: chrisd
Date: Wed Apr  9 11:01:53 2008
New Revision: 646453

URL: http://svn.apache.org/viewvc?rev=646453&view=rev
Log:
Handle integer configuration directive parameters with a dedicated
function, akin to dbd_param_flag().  Only needed when APR_HAS_THREADS.

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/database/mod_dbd.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=646453&r1=646452&r2=646453&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Wed Apr  9 11:01:53 2008
@@ -2,6 +2,9 @@
 Changes with Apache 2.3.0
 [ When backported to 2.2.x, remove entry from this file ]
 
+  *) mod_dbd: Handle integer configuration directive parameters with a
+     dedicated function.
+
   *) Change the directives within the mod_session* modules to be valid
      both inside and outside the location/directory sections, as
      suggested by wrowe. [Graham Leggett]

Modified: httpd/httpd/trunk/modules/database/mod_dbd.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/database/mod_dbd.c?rev=646453&r1=646452&r2=646453&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/database/mod_dbd.c (original)
+++ httpd/httpd/trunk/modules/database/mod_dbd.c Wed Apr  9 11:01:53 2008
@@ -141,16 +141,6 @@
     return svr;
 }
 
-#define ISINT(val) do {                                                 \
-        const char *p;                                                  \
-                                                                        \
-        for (p = val; *p; ++p) {                                        \
-            if (!apr_isdigit(*p)) {                                     \
-                return "Argument must be numeric!";                     \
-            }                                                           \
-        }                                                               \
-    } while (0)
-
 static const char *dbd_param(cmd_parms *cmd, void *dconf, const char *val)
 {
     const apr_dbd_driver_t *driver = NULL;
@@ -185,32 +175,47 @@
     case cmd_params:
         cfg->params = val;
         break;
+    }
+
+    return NULL;
+}
+
 #if APR_HAS_THREADS
+static const char *dbd_param_int(cmd_parms *cmd, void *dconf, const char *val)
+{
+    svr_cfg *svr = ap_get_module_config(cmd->server->module_config,
+                                        &dbd_module);
+    dbd_cfg_t *cfg = svr->cfg;
+    const char *p;
+
+    for (p = val; *p; ++p) {
+        if (!apr_isdigit(*p)) {
+            return "Argument must be numeric!";
+        }
+    }
+
+    switch ((long) cmd->info) {
     case cmd_min:
-        ISINT(val);
         cfg->nmin = atoi(val);
         cfg->set |= NMIN_SET;
         break;
     case cmd_keep:
-        ISINT(val);
         cfg->nkeep = atoi(val);
         cfg->set |= NKEEP_SET;
         break;
     case cmd_max:
-        ISINT(val);
         cfg->nmax = atoi(val);
         cfg->set |= NMAX_SET;
         break;
     case cmd_exp:
-        ISINT(val);
         cfg->exptime = atoi(val);
         cfg->set |= EXPTIME_SET;
         break;
-#endif
     }
 
     return NULL;
 }
+#endif
 
 static const char *dbd_param_flag(cmd_parms *cmd, void *dconf, int flag)
 {
@@ -250,15 +255,15 @@
                    "SQL statement to prepare (or nothing, to override "
                    "statement inherited from main server) and label"),
 #if APR_HAS_THREADS
-    AP_INIT_TAKE1("DBDMin", dbd_param, (void*)cmd_min, RSRC_CONF,
+    AP_INIT_TAKE1("DBDMin", dbd_param_int, (void*)cmd_min, RSRC_CONF,
                   "Minimum number of connections"),
     /* XXX: note that mod_proxy calls this "smax" */
-    AP_INIT_TAKE1("DBDKeep", dbd_param, (void*)cmd_keep, RSRC_CONF,
+    AP_INIT_TAKE1("DBDKeep", dbd_param_int, (void*)cmd_keep, RSRC_CONF,
                   "Maximum number of sustained connections"),
-    AP_INIT_TAKE1("DBDMax", dbd_param, (void*)cmd_max, RSRC_CONF,
+    AP_INIT_TAKE1("DBDMax", dbd_param_int, (void*)cmd_max, RSRC_CONF,
                   "Maximum number of connections"),
     /* XXX: note that mod_proxy calls this "ttl" (time to live) */
-    AP_INIT_TAKE1("DBDExptime", dbd_param, (void*)cmd_exp, RSRC_CONF,
+    AP_INIT_TAKE1("DBDExptime", dbd_param_int, (void*)cmd_exp, RSRC_CONF,
                   "Keepalive time for idle connections"),
 #endif
     {NULL}



Mime
View raw message