bnicholes 2002/12/02 13:21:20
Modified: hooks apr_hooks.c
Log:
Eliminating the per-application global data in the apr_hook source for
NetWare.
Static per-application global data in a library causes a problem on NetWare
because a library NLM does not have application boundaries. All static data
is global to all applications.
Revision Changes Path
1.45 +34 -1 apr-util/hooks/apr_hooks.c
Index: apr_hooks.c
===================================================================
RCS file: /home/cvs/apr-util/hooks/apr_hooks.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- apr_hooks.c 8 Jul 2002 03:58:32 -0000 1.44
+++ apr_hooks.c 2 Dec 2002 21:21:20 -0000 1.45
@@ -102,6 +102,13 @@
struct tsort_ *pNext;
} TSort;
+#ifdef NETWARE
+#define get_apd APP_DATA* apd =
(APP_DATA*)get_app_data(gLibId);
+#define s_aHooksToSort ((apr_array_header_t
*)(apd->gs_aHooksToSort))
+#define s_phOptionalHooks ((apr_hash_t *)(apd->gs_phOptionalHooks))
+#define s_phOptionalFunctions ((apr_hash_t *)(apd->gs_phOptionalFunctions))
+#endif
+
static int crude_order(const void *a_,const void *b_)
{
const TSortData *a=a_;
@@ -216,7 +223,10 @@
return pNew;
}
+#ifndef NETWARE
static apr_array_header_t *s_aHooksToSort;
+#endif
+
typedef struct
{
const char *szHookName;
@@ -226,10 +236,13 @@
APU_DECLARE(void) apr_hook_sort_register(const char *szHookName,
apr_array_header_t **paHooks)
{
+#ifdef NETWARE
+ get_apd
+#endif
HookSortEntry *pEntry;
if(!s_aHooksToSort)
-
s_aHooksToSort=apr_array_make(apr_hook_global_pool,1,sizeof(HookSortEntry));
+
s_aHooksToSort=apr_array_make(apr_hook_global_pool,1,sizeof(HookSortEntry));
pEntry=apr_array_push(s_aHooksToSort);
pEntry->szHookName=szHookName;
pEntry->paHooks=paHooks;
@@ -237,6 +250,9 @@
APU_DECLARE(void) apr_hook_sort_all()
{
+#ifdef NETWARE
+ get_apd
+#endif
int n;
for(n=0 ; n < s_aHooksToSort->nelts ; ++n) {
@@ -251,11 +267,16 @@
apr_hook_sort_all();
}
+#ifndef NETWARE
static apr_hash_t *s_phOptionalHooks;
static apr_hash_t *s_phOptionalFunctions;
+#endif
APU_DECLARE(void) apr_hook_deregister_all(void)
{
+#ifdef NETWARE
+ get_apd
+#endif
int n;
for(n=0 ; n < s_aHooksToSort->nelts ; ++n) {
@@ -314,6 +335,9 @@
APU_DECLARE(apr_array_header_t *) apr_optional_hook_get(const char *szName)
{
+#ifdef NETWARE
+ get_apd
+#endif
apr_array_header_t **ppArray;
if(!s_phOptionalHooks)
@@ -328,6 +352,9 @@
const char * const *aszPre,
const char * const *aszSucc,int nOrder)
{
+#ifdef NETWARE
+ get_apd
+#endif
apr_array_header_t *pArray=apr_optional_hook_get(szName);
apr_LINK__optional_t *pHook;
@@ -357,6 +384,9 @@
APU_DECLARE(apr_opt_fn_t *) apr_dynamic_fn_retrieve(const char *szName)
{
+#ifdef NETWARE
+ get_apd
+#endif
if(!s_phOptionalFunctions)
return NULL;
return
(void(*)(void))apr_hash_get(s_phOptionalFunctions,szName,strlen(szName));
@@ -371,6 +401,9 @@
APU_DECLARE_NONSTD(void) apr_dynamic_fn_register(const char *szName,
apr_opt_fn_t *pfn)
{
+#ifdef NETWARE
+ get_apd
+#endif
if(!s_phOptionalFunctions)
s_phOptionalFunctions=apr_hash_make(apr_hook_global_pool);
apr_hash_set(s_phOptionalFunctions,szName,strlen(szName),(void *)pfn);