Another attempt at measuring the minimum alignment for a system.
[rsync/rsync.git] / lib / pool_alloc.c
index acb356a..c5648b6 100644 (file)
@@ -32,7 +32,12 @@ struct pool_extent
        struct pool_extent      *next;
 };
 
-#define MINALIGN       (sizeof (void *))
+struct align_test {
+    void *foo;
+    uint64 bar;
+};
+
+#define MINALIGN       offsetof(struct align_test, bar)
 
 alloc_pool_t
 pool_create(size_t size, size_t quantum,
@@ -85,7 +90,8 @@ pool_destroy(alloc_pool_t p)
        free(pool);
 }
 
-void *pool_alloc(alloc_pool_t p, size_t len, char *bomb)
+void *
+pool_alloc(alloc_pool_t p, size_t len, char *bomb)
 {
        struct alloc_pool *pool = (struct alloc_pool *) p;
        if (!pool)
@@ -287,11 +293,8 @@ pool_stats(alloc_pool_t p, int fd, int summarize)
        strcpy(buf, "   FREE    BOUND\n");
        write(fd, buf, strlen(buf));
 
-       cur = pool->free;
-       while (cur)
+       for (cur = pool->free; cur; cur = cur->next)
        {
                FDEXTSTAT(cur);
-               cur = cur->next;
        }
 }
-