Index: omalloc/omBin.c
===================================================================
--- omalloc/omBin.c	(revision 2c72eb986386d08c4cad3c7641468921a9faf348)
+++ omalloc/omBin.c	(revision 13fe1bac96f68d4d7cf1801dc2db764cea629bcd)
@@ -4,5 +4,5 @@
  *  Author:  obachman (Olaf Bachmann)
  *  Created: 11/99
- *  Version: $Id: omBin.c,v 1.6 2000-12-12 15:26:15 obachman Exp $
+ *  Version: $Id: omBin.c,v 1.7 2001-04-30 09:02:02 Singular Exp $
  *******************************************************************/
 
@@ -40,13 +40,13 @@
 #else
   align = 0;
-#endif  
-  
+#endif
+
   if (size > SIZEOF_OM_BIN_PAGE)
   {
     /* need page header */
-    max_blocks = - (long) 
+    max_blocks = - (long)
       ((size+(SIZEOF_SYSTEM_PAGE-SIZEOF_OM_BIN_PAGE))+SIZEOF_SYSTEM_PAGE-1)
       / SIZEOF_SYSTEM_PAGE;
-    sizeW = ((-max_blocks*SIZEOF_SYSTEM_PAGE) - 
+    sizeW = ((-max_blocks*SIZEOF_SYSTEM_PAGE) -
              (SIZEOF_SYSTEM_PAGE - SIZEOF_OM_BIN_PAGE)) / SIZEOF_LONG;
     om_new_specBin = om_LargeBin;
@@ -64,5 +64,5 @@
 #endif
       sizeW = ((size + sizeW) & ~ (SIZEOF_OM_ALIGNMENT - 1));
-    
+
     omAssume(sizeW >= size);
     omAssume(max_blocks*sizeW <= SIZEOF_OM_BIN_PAGE);
@@ -87,5 +87,5 @@
     }
 #endif
-    else 
+    else
     {
       om_new_specBin = omSmallSize2Bin( size );
@@ -104,8 +104,8 @@
       s_bin = omFindInSortedGList(om_SpecBin, next, max_blocks, max_blocks);
 
-    if (s_bin != NULL) 
+    if (s_bin != NULL)
     {
       (s_bin->ref)++;
-      omAssume(s_bin->bin != NULL && 
+      omAssume(s_bin->bin != NULL &&
              s_bin->bin->max_blocks == s_bin->max_blocks &&
              s_bin->bin->sizeW == sizeW);
@@ -144,7 +144,7 @@
   if (! omIsStaticBin(bin))
   {
-#ifdef OM_HAVE_TRACK 
+#ifdef OM_HAVE_TRACK
     int track_bin = 0;
-#endif 
+#endif
     omSpecBin s_bin;
 
@@ -156,5 +156,5 @@
 #endif
         s_bin = omFindInSortedGList(om_SpecBin, next, max_blocks, bin->max_blocks);
-        
+
     omAssume(s_bin != NULL && bin == s_bin->bin);
     if (s_bin != NULL)
@@ -164,5 +164,5 @@
       {
 #ifdef OM_HAVE_TRACK
-        if (! track_bin) 
+        if (! track_bin)
 #endif
           omFreeKeptAddrFromBin(s_bin->bin);
@@ -238,10 +238,10 @@
   omBin s_bin;
   s_bin = omGetStickyBin(bin, sticky_tag);
-  
+
   if (s_bin != bin)
   {
     omBinPage tc, tl;
     unsigned long ts;
-    
+
     if (s_bin == NULL) s_bin = omCreateStickyBin(bin, sticky_tag);
     ts = bin->sticky;
@@ -269,6 +269,6 @@
   int length = omGListLength(to_bin->last_page, prev) +
     omGListLength(from_bin->last_page, prev);
-#endif  
-  
+#endif
+
   omBinPage page = from_bin->last_page;
   omAssume(to_bin->sizeW == from_bin->sizeW);
@@ -291,6 +291,6 @@
     return;
   }
-  
-  omAssume(to_bin->current_page != om_ZeroPage && 
+
+  omAssume(to_bin->current_page != om_ZeroPage &&
            to_bin->current_page != NULL);
 
@@ -309,16 +309,16 @@
   {
     /* need to reset this here, since new current_page is going to be
-       from_bin->current_page, and only for current_page may we have 
+       from_bin->current_page, and only for current_page may we have
        used_blocks != 0 && current == NULL */
     to_bin->current_page->used_blocks = 0;
   }
-  
-
-  omAssume(to_bin->current_page != NULL && 
+
+
+  omAssume(to_bin->current_page != NULL &&
            to_bin->current_page->current == NULL &&
            to_bin->current_page->used_blocks == 0);
 
   from_bin->last_page->next = to_bin->current_page->next;
-  if (to_bin->current_page->next != NULL) 
+  if (to_bin->current_page->next != NULL)
     to_bin->current_page->next->prev =  from_bin->last_page;
   else
@@ -330,5 +330,5 @@
   page->prev = to_bin->current_page;
   to_bin->current_page = from_bin->current_page;
-  
+
 #ifdef HAVE_OM_ASSUME
   omAssume(omGListLength(to_bin->last_page, prev) == length);
@@ -346,5 +346,5 @@
     return;
   }
-  
+
   sticky_bin = omGetStickyBin(bin, sticky);
   if (sticky_bin != NULL)
@@ -355,5 +355,5 @@
     omMergeStickyPages(no_sticky_bin, sticky_bin);
 
-    if (bin == sticky_bin) 
+    if (bin == sticky_bin)
     {
       sticky_bin = no_sticky_bin;
@@ -397,5 +397,5 @@
 void omMergeStickyBinIntoBin(omBin sticky_bin, omBin into_bin)
 {
-  if (! omIsOnGList(om_StickyBins, next, sticky_bin) || 
+  if (! omIsOnGList(om_StickyBins, next, sticky_bin) ||
       !sticky_bin->sticky ||
       sticky_bin->max_blocks != into_bin->max_blocks ||
@@ -405,9 +405,9 @@
   {
 #ifndef OM_NDEBUG
-    omReportError(omError_StickyBin, omError_NoError, OM_FLR, 
+    omReportError(omError_StickyBin, omError_NoError, OM_FLR,
                   (! omIsOnGList(om_StickyBins, next, sticky_bin)  ? "unknown sticky_bin" :
-                   (!sticky_bin->sticky ? "sticky_bin is not sticky" : 
+                   (!sticky_bin->sticky ? "sticky_bin is not sticky" :
                     (sticky_bin->max_blocks != into_bin->max_blocks ? "sticky_bin and into_bin have different block sizes" :
-                     (sticky_bin == into_bin ? "sticky_bin == into_bin" : 
+                     (sticky_bin == into_bin ? "sticky_bin == into_bin" :
                       (!omIsKnownTopBin(into_bin, 1) ? "unknown into_bin" :
                        (omIsStickyBin(into_bin) ? "into_bin is sticky" :
@@ -430,7 +430,7 @@
 #if defined(OM_INTERNAL_DEBUG) && !defined(OM_NDEBUG)
   omTestBin(into_bin, 2);
-#endif  
-}
- 
+#endif
+}
+
 /*****************************************************************
 *
@@ -444,14 +444,14 @@
   omSpecBin s_bin;
   int i;
-  
+
   omAssume(normal_bin == 1 || normal_bin == 0);
-  
-#ifdef OM_HAVE_TRACK
-  if (! normal_bin) 
+
+#ifdef OM_HAVE_TRACK
+  if (! normal_bin)
   {
     to_check = om_StaticTrackBin;
     s_bin = om_SpecTrackBin;
   }
-  else 
+  else
 #endif
   {
@@ -463,8 +463,8 @@
   for (i=0; i<= OM_MAX_BIN_INDEX; i++)
   {
-    if (bin == &(to_check[i])) 
+    if (bin == &(to_check[i]))
       return 1;
   }
-  
+
   while (s_bin != NULL)
   {
@@ -495,5 +495,5 @@
   }
   s_bin = om_SpecBin;
-  while (s_bin != NULL) 
+  while (s_bin != NULL)
   {
     new_sticky = omGetMaxStickyBinTag(s_bin->bin);
@@ -501,5 +501,5 @@
     s_bin = s_bin->next;
   }
-  if (sticky < BIT_SIZEOF_LONG - 2) 
+  if (sticky < BIT_SIZEOF_LONG - 2)
   {
     sticky++;
@@ -509,5 +509,5 @@
     }
     s_bin = om_SpecBin;
-    while (s_bin != NULL) 
+    while (s_bin != NULL)
     {
       omCreateStickyBin(s_bin->bin, sticky);
@@ -527,5 +527,5 @@
     }
     s_bin = om_SpecBin;
-    while (s_bin != NULL) 
+    while (s_bin != NULL)
     {
       if (omGetStickyBin(s_bin->bin, BIT_SIZEOF_LONG -1) == NULL)
@@ -545,5 +545,5 @@
     omSetStickyBinTag(&(om_StaticBin[i]), sticky);
   }
-  while (s_bin != NULL) 
+  while (s_bin != NULL)
   {
     omSetStickyBinTag(s_bin->bin, sticky);
@@ -560,5 +560,5 @@
     omUnSetStickyBinTag(&(om_StaticBin[i]), sticky);
   }
-  while (s_bin != NULL) 
+  while (s_bin != NULL)
   {
     omUnSetStickyBinTag(s_bin->bin, sticky);
@@ -575,5 +575,5 @@
     omDeleteStickyBinTag(&(om_StaticBin[i]), sticky);
   }
-  while (s_bin != NULL) 
+  while (s_bin != NULL)
   {
     omDeleteStickyBinTag(s_bin->bin, sticky);
@@ -586,10 +586,10 @@
 {
   omBinPage page = bin->last_page;
-  
+
   while (page != NULL)
   {
     void* addr = (void*) page + SIZEOF_OM_BIN_PAGE_HEADER;
     int i;
-    
+
     for (i=0; i<bin->max_blocks; i++)
     {
@@ -608,14 +608,14 @@
  *
  *****************************************************************/
-static void omGetBinStat(omBin bin, int *pages_p, int *used_blocks_p, 
+static void omGetBinStat(omBin bin, int *pages_p, int *used_blocks_p,
                           int *free_blocks_p)
 {
   int pages = 0, used_blocks = 0, free_blocks = 0;
   int where = 1;
-  
+
   omBinPage page = bin->last_page;
   while (page != NULL)
   {
-    pages++; if (where == 1) 
+    pages++; if (where == 1)
     {
       used_blocks += omGetUsedBlocksOfPage(page) + 1;
@@ -623,5 +623,5 @@
         free_blocks += bin->max_blocks - omGetUsedBlocksOfPage(page) -1;
     }
-    else 
+    else
     {
       if (bin->max_blocks > 1)
@@ -638,10 +638,10 @@
 }
 
-static void omGetTotalBinStat(omBin bin, int *pages_p, int *used_blocks_p, 
+static void omGetTotalBinStat(omBin bin, int *pages_p, int *used_blocks_p,
                                int *free_blocks_p)
 {
   int t_pages = 0, t_used_blocks = 0, t_free_blocks = 0;
   int pages = 0, used_blocks = 0, free_blocks = 0;
- 
+
   while (bin != NULL)
   {
@@ -652,5 +652,5 @@
     if (!omIsStickyBin(bin))
       bin = bin->next;
-    else 
+    else
       bin = NULL;
   }
@@ -668,6 +668,6 @@
   else
   {
-    fprintf(fd, "%s%ld\t%ld\t", (omIsStaticNormalBin(bin) ? " " : 
-                                (omIsStickyBin(bin) ? "S" : 
+    fprintf(fd, "%s%ld\t%ld\t", (omIsStaticNormalBin(bin) ? " " :
+                                (omIsStickyBin(bin) ? "S" :
                                  (omIsTrackBin(bin) ? "T" : "*"))),
             bin->sizeW, bin->max_blocks);
@@ -681,5 +681,5 @@
     {
       omGetBinStat(bin, &s_pages, &s_used_blocks, &s_free_blocks);
-      fprintf(fd, " \t \t%d\t%d\t%d\t%d\n", s_pages, s_free_blocks, s_used_blocks, 
+      fprintf(fd, " \t \t%d\t%d\t%d\t%d\n", s_pages, s_free_blocks, s_used_blocks,
               (int) bin->sticky);
       bin = bin->next;
@@ -690,5 +690,5 @@
   }
 }
-  
+
 void omPrintBinStats(FILE* fd)
 {
@@ -697,5 +697,5 @@
   omSpecBin s_bin = om_SpecBin;
   omBin sticky;
-  
+
   fprintf(fd, " SizeW\tBlocks\tUPages\tFBlocks\tUBlocks\tSticky\n");
   fflush(fd);
@@ -709,5 +709,5 @@
        free_blocks += free_blocks_p;
 #ifdef OM_HAVE_TRACK
-       if (om_StaticTrackBin[i].current_page != om_ZeroPage) 
+       if (om_StaticTrackBin[i].current_page != om_ZeroPage)
        {
          omPrintBinStat(fd, &om_StaticTrackBin[i], 1, &pages_p, &used_blocks_p, &free_blocks_p);
@@ -716,5 +716,5 @@
          free_blocks += free_blocks_p;
        }
-#endif       
+#endif
        i--;
     }
@@ -751,5 +751,5 @@
   fprintf(fd, "      \t      \t%d\t%d\t%d\n", pages, free_blocks, used_blocks);
 }
- 
+
 static  int omGetUsedBytesOfBin(omBin bin)
 {
@@ -765,5 +765,5 @@
   size_t used = 0;
   omBin sticky;
-  
+
   for (; i>=0; i--)
   {
@@ -796,3 +796,2 @@
   return used;
 }
-
