Index: src/xalloc.c
===================================================================
--- src/xalloc.c	(Revision 2414)
+++ src/xalloc.c	(Arbeitskopie)
@@ -44,13 +44,38 @@
 typedef struct { unsigned long counter, size; } t_stat;
   /* A counter type for statistics and its functions: */
 
-#define count(a,b)           { a.size+=(b); if ((b)<0) --a.counter; else ++a.counter; }
-#define count_up(a,b)        { a.size+=(b); ++a.counter; }
-#define count_up_n(a,b,c)    { a.size+=(b)*(c); a.counter+=(b); }
-#define count_add(a,b)       { a.size+=(b); }
-#define count_back(a,b)      { a.size-=(b); --a.counter; }
-#define count_back_n(a,b,c)  { a.size-=(b)*(c); a.counter-=(b); }
+inline void count_add(t_stat *a, unsigned int b) {
+  a->size += b;
+}
 
+inline void count(t_stat *a, unsigned int b) {
+  count_add(a, b);
+  if (b < 0)
+    --a->counter;
+  else
+    ++a->counter;
+}
+
+inline void count_up(t_stat *a, unsigned int b) {
+  count_add(a, b);
+  ++a->counter;
+}
+
+inline void count_up_n(t_stat *a, unsigned int b, unsigned int c) {
+  count_add(a, b * c);
+  a->counter += b;
+}
+
+inline void count_back(t_stat *a, unsigned int b) {
+  count_add(a, -b);
+  --a->counter;
+}
+
+inline void count_back_n(t_stat *a, unsigned int b, unsigned int c) {
+  count_add(a, -(b * c));
+  a->counter -= b;
+}
+
 typedef p_uint word_t;
   /* Our 'word' type.
    */
@@ -555,9 +580,9 @@
         p[XM_PC]   = (word_t)inter_pc;
 #endif
 #ifdef NO_MEM_BLOCK_SIZE
-    count_up(xalloc_stat, XM_OVERHEAD_SIZE);
+    count_up(&xalloc_stat, XM_OVERHEAD_SIZE);
 #else
-    count_up(xalloc_stat, mem_block_size(p));
+    count_up(&xalloc_stat, mem_block_size(p));
     if (check_max_malloced())
         return NULL;
 #endif
@@ -576,9 +601,9 @@
     {
         word_t *q = (word_t*)p - XM_OVERHEAD;
 #ifdef NO_MEM_BLOCK_SIZE
-        count_back(xalloc_stat, XM_OVERHEAD_SIZE);
+        count_back(&xalloc_stat, XM_OVERHEAD_SIZE);
 #else
-        count_back(xalloc_stat, mem_block_size(q));
+        count_back(&xalloc_stat, mem_block_size(q));
 #endif
         mem_free(q);
     }
@@ -673,8 +698,8 @@
 #ifndef NO_MEM_BLOCK_SIZE
     if (rc != NULL)
     {
-        count_back(xalloc_stat, old_size);
-        count_up(xalloc_stat, mem_block_size(block));
+        count_back(&xalloc_stat, old_size);
+        count_up(&xalloc_stat, mem_block_size(block));
         if (check_max_malloced())
             return NULL;
     }
@@ -749,8 +774,8 @@
     if (t)
     {
 #ifndef NO_MEM_BLOCK_SIZE
-        count_back(xalloc_stat, old_size);
-        count_up(xalloc_stat, mem_block_size(t));
+        count_back(&xalloc_stat, old_size);
+        count_up(&xalloc_stat, mem_block_size(t));
         if (check_max_malloced())
             return NULL;
 #endif
@@ -1262,7 +1287,7 @@
     result = amalloc(size);
     if (result)
     {
-        count_up(clib_alloc_stat, get_block_size(result));
+        count_up(&clib_alloc_stat, get_block_size(result));
     }
 
     return result;
@@ -1278,7 +1303,7 @@
 {
     if (ptr)
     {
-        count_back(clib_alloc_stat, get_block_size(ptr));
+        count_back(&clib_alloc_stat, get_block_size(ptr));
     }
 
     afree(ptr);
Index: src/slaballoc.c
===================================================================
--- src/slaballoc.c	(Revision 2414)
+++ src/slaballoc.c	(Arbeitskopie)
@@ -729,7 +729,7 @@
     if (q[-M_OVERHEAD] & M_GC_FREE)
     {
         q[-M_OVERHEAD] &= ~M_GC_FREE;
-        count_up(perm_alloc_stat, mem_block_total_size(q));
+        count_up(&perm_alloc_stat, mem_block_total_size(q));
     }
 } /* mem_mark_permanent() */
 
@@ -746,7 +746,7 @@
     if (!(q[-M_OVERHEAD] & M_GC_FREE))
     {
         q[-M_OVERHEAD] |= (M_REF|M_GC_FREE);
-        count_back(perm_alloc_stat, mem_block_total_size(q));
+        count_back(&perm_alloc_stat, mem_block_total_size(q));
     }
 } /* mem_mark_collectable() */
 
@@ -1513,8 +1513,8 @@
 {
     ulog2f("slaballoc: deallocate slab %x [%d]\n", slab, ix);
     slabtable[ix].numSlabs--;
-    count_back(small_slab_stat, SLAB_SIZE(slab, ix));
-    count_back_n(small_free_stat, slabtable[ix].numBlocks, slab->size);
+    count_back(&small_slab_stat, SLAB_SIZE(slab, ix));
+    count_back_n(&small_free_stat, slabtable[ix].numBlocks, slab->size);
 #ifdef MALLOC_EXT_STATISTICS
     extstats[SIZE_INDEX(slab->size)].cur_free -= slabtable[ix].numBlocks;
     extstats[EXTSTAT_SLABS].cur_free--;
@@ -1591,7 +1591,7 @@
     ulog2f(" %d bytes -> [%d]\n", size, ix);
 
     /* Update statistics */
-    count_up(small_alloc_stat,size);
+    count_up(&small_alloc_stat,size);
 
 #ifdef MALLOC_EXT_STATISTICS
     extstats[SIZE_INDEX(size)].num_xalloc++;
@@ -1612,7 +1612,7 @@
 
         block = slab->freeList;
         slab->freeList = BLOCK_NEXT(slab->freeList);
-        count_back(small_free_stat, slab->size);
+        count_back(&small_free_stat, slab->size);
 
 #ifdef MALLOC_EXT_STATISTICS
         extstats[ix].cur_free--;
@@ -1701,7 +1701,7 @@
             }
 
             slabtable[ix].numFreeSlabs--;
-            count_back(small_slab_free_stat, SLAB_SIZE(slab, ix));
+            count_back(&small_slab_free_stat, SLAB_SIZE(slab, ix));
 #ifdef MALLOC_EXT_STATISTICS
             extstats[EXTSTAT_SLABS].cur_free--;
 #endif /* MALLOC_EXT_STATISTICS */
@@ -1733,8 +1733,8 @@
             slab->size = size;
 
             slabtable[ix].numSlabs++;
-            count_up(small_slab_stat, slabSize);
-            count_up_n(small_free_stat, numObjects, size);
+            count_up(&small_slab_stat, slabSize);
+            count_up_n(&small_free_stat, numObjects, size);
 #ifdef MALLOC_EXT_STATISTICS
             extstats[ix].cur_free += numObjects;
             extstats[EXTSTAT_SLABS].num_xalloc++;
@@ -1781,7 +1781,7 @@
 
         MADVISE(block, orig_size);
 
-        count_back(small_free_stat, size);
+        count_back(&small_free_stat, size);
 #ifdef MALLOC_EXT_STATISTICS
         extstats[ix].cur_free--;
 #endif /* MALLOC_EXT_STATISTICS */
@@ -1870,7 +1870,7 @@
     /* It's a small block: put it into the slab's free list */
 
     slab = (mslab_t*)(block - (block[M_SIZE] & M_MASK));
-    count_back(small_alloc_stat, slab->size);
+    count_back(&small_alloc_stat, slab->size);
     ix =  SIZE_INDEX(slab->size);
 
     ulog4f("slaballoc:   -> slab %x [%d], freelist %x, %d free\n"
@@ -1933,7 +1933,7 @@
     slab->freeList = block;
     slab->numAllocated--;
 
-    count_up(small_free_stat, slab->size);
+    count_up(&small_free_stat, slab->size);
 
     /* If this slab is not the fresh slab, handle possible list movements.
      */
@@ -1993,7 +1993,7 @@
                 slabtable[ix].firstFree = slab;
 
                 slabtable[ix].numFreeSlabs++;
-                count_up(small_slab_free_stat, SLAB_SIZE(slab, ix));
+                count_up(&small_slab_free_stat, SLAB_SIZE(slab, ix));
 #ifdef MALLOC_EXT_STATISTICS
                 extstats[EXTSTAT_SLABS].cur_alloc--;
                 extstats[EXTSTAT_SLABS].cur_free++;
@@ -2314,7 +2314,7 @@
     }
 #endif
     p = (struct free_block *)(ptr+M_OVERHEAD);
-    count_back(large_free_stat, p->size);
+    count_back(&large_free_stat, p->size);
 #ifdef MALLOC_EXT_STATISTICS
     extstats[EXTSTAT_LARGE].cur_free--;
 #endif /* MALLOC_EXT_STATISTICS */
@@ -2703,7 +2703,7 @@
                                     * register choice
                                     */
     r = (struct free_block *)(ptr+M_OVERHEAD);
-    count_up(large_free_stat, size);
+    count_up(&large_free_stat, size);
 #ifdef MALLOC_EXT_STATISTICS
     extstats[EXTSTAT_LARGE].cur_free++;
     extstat_update_max(extstats+EXTSTAT_LARGE);
@@ -3344,7 +3344,7 @@
         {
             mark_block(ptr+size);
             *(ptr+size) &= ~M_GC_FREE; /* Hands off, GC! */
-            count_up(large_wasted_stat, (*(ptr+size) & M_MASK) * SINT);
+            count_up(&large_wasted_stat, (*(ptr+size) & M_MASK) * SINT);
         }
         else
 #       endif
@@ -3360,7 +3360,7 @@
     /* The block at ptr is all ours */
 
     mark_block(ptr);
-    count_up(large_alloc_stat, size);
+    count_up(&large_alloc_stat, size);
 #ifdef MALLOC_EXT_STATISTICS
     extstats[EXTSTAT_LARGE].num_xalloc++;
     extstats[EXTSTAT_LARGE].cur_alloc++;
@@ -3388,7 +3388,7 @@
     p = (word_t *) ptr;
     p -= M_OVERHEAD;
     size = p[M_LSIZE];
-    count_back(large_alloc_stat, size);
+    count_back(&large_alloc_stat, size);
 #ifdef MALLOC_EXT_STATISTICS
     extstats[EXTSTAT_LARGE].num_xfree++;
     extstats[EXTSTAT_LARGE].cur_alloc--;
@@ -3460,7 +3460,7 @@
         }
         *heap_start = 2;
         *(heap_start+1) = PREV_BLOCK | M_MASK;
-        count_up(large_wasted_stat, 2*SINT);
+        count_up(&large_wasted_stat, 2*SINT);
         assert_stack_gap();
     }
 
@@ -3468,7 +3468,7 @@
     if ((int)brk((char *)heap_end + size) == -1)
         return NULL;
 
-    count_up(sbrk_stat, size);
+    count_up(&sbrk_stat, size);
     heap_end = (word_t*)((char *)heap_end + size);
     heap_end[-1] = THIS_BLOCK | M_MASK;
     heap_end[-2] = M_MASK;
@@ -3535,7 +3535,7 @@
                 /* We can join with the existing heap */
                 p[overhead] &= ~PREV_BLOCK;
                 overlap = SINT;
-                count_back(large_wasted_stat, overlap);
+                count_back(&large_wasted_stat, overlap);
             }
             else
             {
@@ -3559,7 +3559,7 @@
                 heap_end = (word_t *)(block + size);
                 block -= overhead;
                 overlap = overhead * SINT;
-                count_back(large_wasted_stat, overlap);
+                count_back(&large_wasted_stat, overlap);
             }
             else
             {
@@ -3594,7 +3594,7 @@
                 /* Our block directly follows the one we found */
                 block -= overhead;
                 overlap += overhead * SINT;
-                count_back(large_wasted_stat, overhead * SINT);
+                count_back(&large_wasted_stat, overhead * SINT);
             }
             else
             {
@@ -3619,7 +3619,7 @@
                 /* Our block directly preceedes the next one */
                 *(next+1) &= ~PREV_BLOCK;
                 overlap += overhead * SINT;
-                count_back(large_wasted_stat, overhead * SINT);
+                count_back(&large_wasted_stat, overhead * SINT);
             }
             else
             {
@@ -3630,8 +3630,8 @@
         }
     }
 
-    count_up(sbrk_stat, size);
-    count_up(large_wasted_stat, overhead * SINT);
+    count_up(&sbrk_stat, size);
+    count_up(&large_wasted_stat, overhead * SINT);
 
     *pExtra = overlap;
     return block + SINT;
@@ -3681,7 +3681,7 @@
         start[M_LSIZE] += wsize;
         malloc_increment_size_success++;
         malloc_increment_size_total += (start2 - start) - M_OVERHEAD;
-        count_add(large_alloc_stat, wsize);
+        count_add(&large_alloc_stat, wsize);
 
         return start2+M_LSIZE;
     }
@@ -3699,7 +3699,7 @@
         start[M_LSIZE] += wsize;
         malloc_increment_size_success++;
         malloc_increment_size_total += (start2 - start) - M_OVERHEAD;
-        count_add(large_alloc_stat, wsize);
+        count_add(&large_alloc_stat, wsize);
         return start2+M_LSIZE;
     }
 
@@ -3950,7 +3950,7 @@
         {
             /* Unref'd small blocks are definitely lost */
             success++;
-            count_back(xalloc_stat, slab->size - (T_OVERHEAD * SINT));
+            count_back(&xalloc_stat, slab->size - (T_OVERHEAD * SINT));
             dprintf2(gcollect_outfd, "freeing small block 0x%x (user 0x%x)"
                     , (p_uint)p, (p_uint)(p+M_OVERHEAD));
 #ifdef MALLOC_TRACE
@@ -4007,7 +4007,7 @@
             word_t size2, flags2;
 
             success++;
-            count_back(xalloc_stat, mem_block_size(p+ML_OVERHEAD));
+            count_back(&xalloc_stat, mem_block_size(p+ML_OVERHEAD));
 #if defined(MALLOC_TRACE) || defined(MALLOC_LPC_TRACE)
             dprintf1(gcollect_outfd, "freeing large block 0x%x", (p_uint)p);
 #endif
@@ -4319,7 +4319,7 @@
             while (NULL != (slab = slabtable[ix].firstFree))
             {
                 slabtable[ix].firstFree = slab->next;
-                count_back(small_slab_free_stat, SLAB_SIZE(slab, ix));
+                count_back(&small_slab_free_stat, SLAB_SIZE(slab, ix));
                 free_slab(slab, ix);
             }
             slabtable[ix].numFreeSlabs = 0;
@@ -4343,7 +4343,7 @@
                 else
                     slabtable[ix].firstFree = NULL;
                 slabtable[ix].numFreeSlabs--;
-                count_back(small_slab_free_stat, SLAB_SIZE(slab, ix));
+                count_back(&small_slab_free_stat, SLAB_SIZE(slab, ix));
                 free_slab(slab, ix);
             }
 #ifdef DEBUG_MALLOC_ALLOCS
