s3-talloc Change TALLOC_ZERO_ARRAY() to talloc_zero_array()
[kai/samba.git] / source3 / lib / bitmap.c
index 37c5b4510e25ee10f960f44762422838ab11107f..5216b05c58554a2013a527f1be059736169aeabf 100644 (file)
 /* these functions provide a simple way to allocate integers from a
    pool without repetition */
 
-/****************************************************************************
-allocate a bitmap of the specified size
-****************************************************************************/
-struct bitmap *bitmap_allocate(int n)
-{
-       struct bitmap *bm;
-
-       bm = SMB_MALLOC_P(struct bitmap);
-
-       if (!bm) return NULL;
-
-       bm->n = n;
-       bm->b = SMB_MALLOC_ARRAY(uint32, (n+31)/32);
-       if (!bm->b) {
-               SAFE_FREE(bm);
-               return NULL;
-       }
-
-       memset(bm->b, 0, sizeof(uint32)*((n+31)/32));
-
-       return bm;
-}
-
-/****************************************************************************
-free a bitmap.
-****************************************************************************/
-
-void bitmap_free(struct bitmap *bm)
-{
-       if (!bm)
-               return;
-
-       SAFE_FREE(bm->b);
-       SAFE_FREE(bm);
-}
-
 /****************************************************************************
 talloc a bitmap
 ****************************************************************************/
@@ -65,12 +29,12 @@ struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n)
 {
        struct bitmap *bm;
 
-       bm = TALLOC_P(mem_ctx, struct bitmap);
+       bm = talloc(mem_ctx, struct bitmap);
 
        if (!bm) return NULL;
 
        bm->n = n;
-       bm->b = TALLOC_ZERO_ARRAY(bm, uint32, (n+31)/32);
+       bm->b = talloc_zero_array(bm, uint32, (n+31)/32);
        if (!bm->b) {
                TALLOC_FREE(bm);
                return NULL;