lemoncake

rbtree based memory allocator
git clone git://git.2f30.org/lemoncake.git
Log | Files | Refs | README | LICENSE

commit 9a578a877de7336db8a5e12f616196962101bb28
parent d23369c183e0df4e5deed0038d429518a9439966
Author: sin <sin@2f30.org>
Date:   Sun Aug  4 17:13:38 +0100

Fix indentation in dumpstats()

Diffstat:
lemoncake.c | 48++++++++++++++++++++++++------------------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/lemoncake.c b/lemoncake.c @@ -407,28 +407,28 @@ dumpstats(void) char *p; fd = open("lemoncake.out", O_WRONLY | O_CREAT | O_APPEND, 0644); - if (fd != -1) { - p = getenv("_"); - if (p) - writelog(fd, "*** Lemoncake stats for process: %s ***\n", p); - writelog(fd, "Number of mmap calls: %lu\n", st.nr_mmap); - writelog(fd, "Number of malloc calls: %lu\n", st.nr_malloc); - writelog(fd, "Number of realloc calls: %lu\n", st.nr_realloc); - writelog(fd, "Number of shrinked realloc calls (no memcpy() required): %lu\n", - st.nr_shrink_realloc); - writelog(fd, "Number of free calls: %lu\n", st.nr_free); - writelog(fd, "Number of new allocations: %lu\n", st.nr_alloc_new); - writelog(fd, "Number of allocations from the free tree: %lu\n", - st.nr_alloc_free); - writelog(fd, "Number of invalid free calls: %lu\n", st.nr_invalid_free); - RB_FOREACH(n, alloc_tree, &at) - st.nr_at_nodes++; - RB_FOREACH(n, free_tree, &ft) - st.nr_ft_nodes++; - writelog(fd, "Number of nodes in the allocation tree: %lu\n", - st.nr_at_nodes); - writelog(fd, "Number of nodes in the free tree: %lu\n", - st.nr_ft_nodes); - close(fd); - } + if (fd < 0) + return; + p = getenv("_"); + if (p) + writelog(fd, "*** Lemoncake stats for process: %s ***\n", p); + writelog(fd, "Number of mmap calls: %lu\n", st.nr_mmap); + writelog(fd, "Number of malloc calls: %lu\n", st.nr_malloc); + writelog(fd, "Number of realloc calls: %lu\n", st.nr_realloc); + writelog(fd, "Number of shrinked realloc calls (no memcpy() required): %lu\n", + st.nr_shrink_realloc); + writelog(fd, "Number of free calls: %lu\n", st.nr_free); + writelog(fd, "Number of new allocations: %lu\n", st.nr_alloc_new); + writelog(fd, "Number of allocations from the free tree: %lu\n", + st.nr_alloc_free); + writelog(fd, "Number of invalid free calls: %lu\n", st.nr_invalid_free); + RB_FOREACH(n, alloc_tree, &at) + st.nr_at_nodes++; + RB_FOREACH(n, free_tree, &ft) + st.nr_ft_nodes++; + writelog(fd, "Number of nodes in the allocation tree: %lu\n", + st.nr_at_nodes); + writelog(fd, "Number of nodes in the free tree: %lu\n", + st.nr_ft_nodes); + close(fd); }