summaryrefslogtreecommitdiff
path: root/src/bitmap.c
blob: f7ee3dd4bbdc24da41edd8213cdbf4896446a3ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Copyright (c) 2007, Novell Inc.
 *
 * This program is licensed under the BSD license, read LICENSE.BSD
 * for further information
 */

/*
 * bitmap.c
 * 
 */

#include <stdlib.h>
#include <string.h>

#include "bitmap.h"
#include "util.h"

void
map_init(Map *m, int n)
{
  m->size = (n + 7) >> 3;
  m->map = sat_calloc(m->size, 1);
}

// free space allocated
void
map_free(Map *m)
{
  m->map = sat_free(m->map);
  m->size = 0;
}

// copy t <- s
void
map_clone(Map *t, Map *s)
{
  t->size = s->size;
  t->map = sat_malloc(s->size);
  memcpy(t->map, s->map, t->size);
}

// EOF