diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-12-16 18:08:47 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2007-12-16 18:08:47 +0000 |
commit | 121de618a78a26d0b64fce317c85ff3306a6a047 (patch) | |
tree | 0b4256b1dca0b9d221b64a1f95b02a8ae85ddc3d /src/allocators-store.c | |
parent | cdbffbf376fd5974102bf7ad4ca6fdbc12043350 (diff) |
Fixup order of empty allocators.
Diffstat (limited to 'src/allocators-store.c')
-rw-r--r-- | src/allocators-store.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/allocators-store.c b/src/allocators-store.c index bfab989..9c5b76b 100644 --- a/src/allocators-store.c +++ b/src/allocators-store.c @@ -84,11 +84,6 @@ _sum_allocators_cmp_by_size (gconstpointer A, gconstpointer B) const struct _sum_allocator * const *aa = A, * const *bb = B; const struct _sum_allocator *a = *aa, *b = *bb; - if (b->size == 0) - return 1; - if (a->size == 0) - return -1; - /* beware integer overflow! */ if (b->size > a->size) return 1; @@ -105,6 +100,11 @@ _sum_allocators_cmp_by_size (gconstpointer A, gconstpointer B) else if (b->n_pages < a->n_pages) return -1; + if (b->size == 0) + return -1; + if (a->size == 0) + return 1; + return b->n_pages * 4096 / b->size * b->count - a->n_pages * 4096 / a->size * a->count; } @@ -114,11 +114,6 @@ _sum_allocators_cmp_by_count (gconstpointer A, gconstpointer B) const struct _sum_allocator * const *aa = A, * const *bb = B; const struct _sum_allocator *a = *aa, *b = *bb; - if (b->size == 0) - return 1; - if (a->size == 0) - return -1; - /* beware integer overflow! */ if (b->count > a->count) return 1; @@ -135,6 +130,11 @@ _sum_allocators_cmp_by_count (gconstpointer A, gconstpointer B) else if (b->size < a->size) return -1; + if (b->size == 0) + return -1; + if (a->size == 0) + return 1; + return b->n_pages * 4096 / b->size * b->count - a->n_pages * 4096 / a->size * a->count; } |