From 0acd50d15026fd0a2aedd642693a75e74c86b43a Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Wed, 1 Apr 2009 22:06:49 +0000 Subject: [PATCH] clean up apr_time_from_msec() compatibility macros * where needed, base on APR_VERSION_AT_LEAST() so we remember what this is about * where not, axe git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@761084 13f79535-47bb-0310-9956-ffa450edef68 --- modules/cluster/mod_heartmonitor.c | 6 ------ modules/proxy/mod_serf.c | 8 ++++---- modules/test/mod_dialup.c | 5 ----- server/mpm/event/event.c | 9 +++++---- server/mpm/simple/simple_run.c | 9 +++++---- 5 files changed, 14 insertions(+), 23 deletions(-) diff --git a/modules/cluster/mod_heartmonitor.c b/modules/cluster/mod_heartmonitor.c index cf9f42852a..78b391ad39 100644 --- a/modules/cluster/mod_heartmonitor.c +++ b/modules/cluster/mod_heartmonitor.c @@ -297,12 +297,6 @@ static apr_status_t hm_recv(hm_ctx_t *ctx, apr_pool_t *p) return rv; } - -#ifndef apr_time_from_msec -#define apr_time_from_msec(x) (x * 1000) -#endif - - static apr_status_t hm_watchdog_callback(int state, void *data, apr_pool_t *pool) { diff --git a/modules/proxy/mod_serf.c b/modules/proxy/mod_serf.c index 35c252f4af..019b32ddab 100644 --- a/modules/proxy/mod_serf.c +++ b/modules/proxy/mod_serf.c @@ -26,6 +26,7 @@ #include "serf.h" #include "apr_uri.h" #include "apr_strings.h" +#include "apr_version.h" #include "ap_mpm.h" module AP_MODULE_DECLARE_DATA serf_module; @@ -62,6 +63,9 @@ typedef struct { serf_bucket_t *body_bkt; } s_baton_t; +#if !APR_VERSION_AT_LEAST(1,4,0) +#define apr_time_from_msec(x) (x * 1000) +#endif /** * This works right now because all timers are invoked in the single listener @@ -393,10 +397,6 @@ static apr_status_t setup_request(serf_request_t *request, return APR_SUCCESS; } -#ifndef apr_time_from_msec -#define apr_time_from_msec(x) (x * 1000) -#endif - /* TOOD: rewrite drive_serf to make it async */ static int drive_serf(request_rec *r, serf_config_t *conf) { diff --git a/modules/test/mod_dialup.c b/modules/test/mod_dialup.c index 85059e21b5..a39b0024e4 100644 --- a/modules/test/mod_dialup.c +++ b/modules/test/mod_dialup.c @@ -31,11 +31,6 @@ module AP_MODULE_DECLARE_DATA dialup_module; -#ifndef apr_time_from_msec -#define apr_time_from_msec(x) (x * 1000) -#endif - - typedef struct dialup_dcfg_t { apr_size_t bytes_per_second; } dialup_dcfg_t; diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index 06f07a8cd6..fac39c49b8 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -57,6 +57,7 @@ #include "apr_queue.h" #define APR_WANT_STRFUNC #include "apr_want.h" +#include "apr_version.h" #if APR_HAVE_UNISTD_H #include @@ -143,6 +144,10 @@ #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid) +#if !APR_VERSION_AT_LEAST(1,4,0) +#define apr_time_from_msec(x) (x * 1000) +#endif + /* * Actual definitions of config globals */ @@ -1031,10 +1036,6 @@ static apr_status_t event_register_timed_callback(apr_time_t t, return APR_SUCCESS; } -#ifndef apr_time_from_msec -#define apr_time_from_msec(x) (x * 1000) -#endif - static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy) { timer_event_t *ep; diff --git a/server/mpm/simple/simple_run.c b/server/mpm/simple/simple_run.c index f8c34e901c..0004885273 100644 --- a/server/mpm/simple/simple_run.c +++ b/server/mpm/simple/simple_run.c @@ -29,6 +29,11 @@ #include "ap_listen.h" #include "mpm_common.h" +#include "apr_version.h" + +#if !APR_VERSION_AT_LEAST(1,4,0) +#define apr_time_from_msec(msec) ((apr_time_t)(msec) * 1000) +#endif /** * Create Timers. @@ -135,10 +140,6 @@ static void *simple_timer_invoke(apr_thread_t * thread, void *baton) return NULL; } -#ifndef apr_time_from_msec -#define apr_time_from_msec(msec) ((apr_time_t)(msec) * 1000) -#endif - static int simple_run_loop(simple_core_t * sc) { apr_status_t rv; -- 2.50.1