]> git.proxmox.com Git - systemd.git/blobdiff - src/basic/bitmap.c
Imported Upstream version 231
[systemd.git] / src / basic / bitmap.c
index ad1fda0198f4264b3344d80764a89386644fc194..f4b12fc261460a3e6f27d739ebb3f929806e890f 100644 (file)
@@ -50,6 +50,23 @@ Bitmap *bitmap_new(void) {
         return new0(Bitmap, 1);
 }
 
+Bitmap *bitmap_copy(Bitmap *b) {
+        Bitmap *ret;
+
+        ret = bitmap_new();
+        if (!ret)
+                return NULL;
+
+        ret->bitmaps = newdup(uint64_t, b->bitmaps, b->n_bitmaps);
+        if (!ret->bitmaps) {
+                free(ret);
+                return NULL;
+        }
+
+        ret->n_bitmaps = ret->bitmaps_allocated = b->n_bitmaps;
+        return ret;
+}
+
 void bitmap_free(Bitmap *b) {
         if (!b)
                 return;