From 8c908fb220d569d5ac829c406c2f67658607460e Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Wed, 17 Jun 2009 16:40:46 +0200 Subject: - beautify --- src/bitmap.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/bitmap.c') diff --git a/src/bitmap.c b/src/bitmap.c index 064fc4a..0485945 100644 --- a/src/bitmap.c +++ b/src/bitmap.c @@ -21,7 +21,7 @@ void map_init(Map *m, int n) { m->size = (n + 7) >> 3; - m->map = n ? sat_calloc(m->size, 1) : 0; + m->map = m->size ? sat_calloc(m->size, 1) : 0; } /* destructor */ @@ -37,8 +37,13 @@ void map_init_clone(Map *t, Map *s) { t->size = s->size; - t->map = sat_malloc(s->size); - memcpy(t->map, s->map, t->size); + if (s->size) + { + t->map = sat_malloc(s->size); + memcpy(t->map, s->map, s->size); + } + else + t->map = 0; } /* grow a map */ -- cgit v1.2.3