--- srclib/apr/memory/unix/apr_pools.c~	Sat Aug 25 15:17:54 2001
+++ srclib/apr/memory/unix/apr_pools.c	Sat Aug 25 15:25:45 2001
@@ -118,6 +118,14 @@
 
 #define ALIGN_DEFAULT(size) ALIGN(size, 8)
 
+#define LOCK(lock) \
+    if (lock) \
+        apr_lock_acquire(lock);
+
+#define UNLOCK(lock) \
+    if (lock) \
+        apr_lock_release(lock);
+
 /*
  * Structures
  */
@@ -190,8 +198,7 @@
 
     index = (size >> BOUNDARY_INDEX) - 1;
     if (index <= allocator->max_index) {
-        if (allocator->lock)
-            apr_lock_acquire(allocator->lock);
+        LOCK(allocator->lock)
 
         max_index = allocator->max_index;
         ref = &allocator->free[index];
@@ -214,18 +221,15 @@
             else
                 node->next = NULL;
 
-            if (allocator->lock)
-                apr_lock_release(allocator->lock);
+            UNLOCK(allocator->lock)
 
             return node;
         }
 
-        if (allocator->lock)
-            apr_lock_release(allocator->lock);
+        UNLOCK(allocator->lock)
     }
     else if (allocator->free[0]) {
-        if (allocator->lock)
-            apr_lock_acquire(allocator->lock);
+        LOCK(allocator->lock)
 
         ref = &allocator->free[0];
         while ((node = *ref) != NULL && index > node->index)
@@ -235,14 +239,12 @@
             *ref = node->next;
             node->next = NULL;
                 
-            if (allocator->lock)
-                apr_lock_release(allocator->lock);
+            UNLOCK(allocator->lock)
 
             return node;
         }
         
-        if (allocator->lock)
-            apr_lock_release(allocator->lock);
+        UNLOCK(allocator->lock)
     }
 
     if ((node = malloc(size)) == NULL)
@@ -261,8 +263,7 @@
     node_t *next;
     apr_uint32_t index, max_index;
 
-    if (allocator->lock)
-        apr_lock_acquire(allocator->lock);
+    LOCK(allocator->lock)
 
     max_index = allocator->max_index;
 
@@ -285,8 +286,7 @@
 
     allocator->max_index = max_index;
 
-    if (allocator->lock)
-        apr_lock_release(allocator->lock);
+    UNLOCK(allocator->lock)
 }
 
 APR_DECLARE(void *) apr_palloc(apr_pool_t *pool, apr_size_t size)
@@ -437,14 +437,12 @@
     if (pool->parent) {
         lock = pool->parent->allocator->lock;
 
-        if (lock)
-            apr_lock_acquire(lock);
+        LOCK(lock)
 
         if ((*pool->ref = pool->sibling) != NULL)
             pool->sibling->ref = pool->ref;
 
-        if (lock)
-            apr_lock_release(lock);
+        UNLOCK(lock)
     }
     
     /*
@@ -567,8 +565,8 @@
 
         if ((pool->parent = parent) != NULL) {
             lock = parent->allocator->lock;
-            if (lock)
-                apr_lock_acquire(lock);
+            
+            LOCK(lock)
 
             if ((pool->sibling = parent->child) != NULL)
                 pool->sibling->ref = &pool->sibling;
@@ -576,8 +574,7 @@
             parent->child = pool;
             pool->ref = &parent->child;
 
-            if (lock)
-                apr_lock_release(lock);
+            UNLOCK(lock)
         }
         else {
             pool->sibling = NULL;
@@ -617,8 +614,7 @@
 #endif
     
     if ((pool->parent = parent) != NULL) {
-        if (allocator->lock)
-            apr_lock_acquire(allocator->lock);
+        LOCK(allocator->lock)
 
         if ((pool->sibling = parent->child) != NULL)
             pool->sibling->ref = &pool->sibling;
@@ -626,8 +622,7 @@
         parent->child = pool;
         pool->ref = &parent->child;
 
-        if (allocator->lock)
-            apr_lock_release(allocator->lock);
+        UNLOCK(allocator->lock)
     }
     else {
         pool->sibling = NULL;
