diff options
author | Michael Schroeder <mls@suse.de> | 2009-06-15 18:08:50 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2009-06-15 18:08:50 +0200 |
commit | 7abdb555bc9e456cac39b0bd193d92b6eefbf57e (patch) | |
tree | 6cbe163cdb99344af3780ae08f5aa4b9f083cc02 /src/bitmap.c | |
parent | 36d2eb249d9403b619ff0f43fb58c11e63f824c2 (diff) | |
download | libsolv-7abdb555bc9e456cac39b0bd193d92b6eefbf57e.tar.gz libsolv-7abdb555bc9e456cac39b0bd193d92b6eefbf57e.tar.bz2 libsolv-7abdb555bc9e456cac39b0bd193d92b6eefbf57e.zip |
- code cleanup
Diffstat (limited to 'src/bitmap.c')
-rw-r--r-- | src/bitmap.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/bitmap.c b/src/bitmap.c index 200bb41..064fc4a 100644 --- a/src/bitmap.c +++ b/src/bitmap.c @@ -16,6 +16,7 @@ #include "bitmap.h" #include "util.h" +/* constructor */ void map_init(Map *m, int n) { @@ -23,7 +24,7 @@ map_init(Map *m, int n) m->map = n ? sat_calloc(m->size, 1) : 0; } -// free space allocated +/* destructor */ void map_free(Map *m) { @@ -31,7 +32,7 @@ map_free(Map *m) m->size = 0; } -// copy t <- s +/* copy constructor t <- s */ void map_init_clone(Map *t, Map *s) { @@ -40,4 +41,17 @@ map_init_clone(Map *t, Map *s) memcpy(t->map, s->map, t->size); } -// EOF +/* grow a map */ +void +map_grow(Map *m, int n) +{ + n = (n + 7) >> 3; + if (m->size < n) + { + m->map = sat_realloc(m->map, n); + memset(m->map + m->size, 0, n - m->size); + m->size = n; + } +} + +/* EOF */ |