Imported Upstream version 1.2
[platform/upstream/libunwind.git] / src / mi / mempool.c
index dbc183f..536b64e 100644 (file)
@@ -1,6 +1,6 @@
 /* libunwind - a platform-independent unwind library
    Copyright (C) 2002-2003, 2005 Hewlett-Packard Co
-       Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+        Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
    Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
 
 This file is part of libunwind.
@@ -30,13 +30,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
  * __BIGGEST_ALIGNMENT__, which is the largest alignment ever used for any data
  * type on the target machine you are compiling for.'' */
 #ifdef __BIGGEST_ALIGNMENT__
-# define MAX_ALIGN     __BIGGEST_ALIGNMENT__
+# define MAX_ALIGN      __BIGGEST_ALIGNMENT__
 #else
 /* Crude hack to check that MAX_ALIGN is power-of-two.
  * sizeof(long double) = 12 on i386. */
-# define MAX_ALIGN_(n) (n < 8 ? 8 : \
-                        n < 16 ? 16 : n)
-# define MAX_ALIGN     MAX_ALIGN_(sizeof (long double))
+# define MAX_ALIGN_(n)  (n < 8 ? 8 : \
+                         n < 16 ? 16 : n)
+# define MAX_ALIGN      MAX_ALIGN_(sizeof (long double))
 #endif
 
 static char sos_memory[SOS_MEMORY_SIZE] ALIGNED(MAX_ALIGN);
@@ -64,9 +64,9 @@ sos_alloc (size_t size)
     /* No assumptions about `sos_memory' alignment. */
     if (sos_memory_freepos == 0)
       {
-       unsigned align = UNW_ALIGN((uintptr_t) &sos_memory[0], MAX_ALIGN)
-                               - (uintptr_t) &sos_memory[0];
-       sos_memory_freepos = align;
+        unsigned align = UNW_ALIGN((uintptr_t) &sos_memory[0], MAX_ALIGN)
+                                - (uintptr_t) &sos_memory[0];
+        sos_memory_freepos = align;
       }
     pos = sos_memory_freepos;
     sos_memory_freepos += size;
@@ -114,11 +114,11 @@ expand (struct mempool *pool)
       size = UNW_ALIGN(pool->obj_size, pg_size);
       GET_MEMORY (mem, size);
       if (!mem)
-       {
-         /* last chance: try to allocate one object from the SOS memory */
-         size = pool->obj_size;
-         mem = sos_alloc (size);
-       }
+        {
+          /* last chance: try to allocate one object from the SOS memory */
+          size = pool->obj_size;
+          mem = sos_alloc (size);
+        }
     }
   add_memory (pool, mem, size, pool->obj_size);
 }
@@ -140,7 +140,7 @@ mempool_init (struct mempool *pool, size_t obj_size, size_t reserve)
     {
       reserve = pg_size / obj_size / 4;
       if (!reserve)
-       reserve = 16;
+        reserve = 16;
     }
 
   pool->obj_size = obj_size;