summaryrefslogtreecommitdiff
path: root/source/lib/bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/lib/bitmap.c')
-rw-r--r--source/lib/bitmap.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/lib/bitmap.c b/source/lib/bitmap.c
index 3fa20cdd112..f2442d2add4 100644
--- a/source/lib/bitmap.c
+++ b/source/lib/bitmap.c
@@ -30,18 +30,18 @@ struct bitmap *bitmap_allocate(int n)
{
struct bitmap *bm;
- bm = (struct bitmap *)malloc(sizeof(*bm));
+ bm = SMB_MALLOC_P(struct bitmap);
if (!bm) return NULL;
bm->n = n;
- bm->b = (uint32 *)malloc(sizeof(bm->b[0])*(n+31)/32);
+ bm->b = SMB_MALLOC_ARRAY(uint32, (n+31)/32);
if (!bm->b) {
SAFE_FREE(bm);
return NULL;
}
- memset(bm->b, 0, sizeof(bm->b[0])*(n+31)/32);
+ memset(bm->b, 0, sizeof(uint32)*((n+31)/32));
return bm;
}
@@ -68,17 +68,17 @@ struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n)
if (!mem_ctx) return NULL;
- bm = (struct bitmap *)talloc(mem_ctx, sizeof(*bm));
+ bm = TALLOC_P(mem_ctx, struct bitmap);
if (!bm) return NULL;
bm->n = n;
- bm->b = (uint32 *)talloc(mem_ctx, sizeof(bm->b[0])*(n+31)/32);
+ bm->b = TALLOC_ARRAY(mem_ctx, uint32, (n+31)/32);
if (!bm->b) {
return NULL;
}
- memset(bm->b, 0, sizeof(bm->b[0])*(n+31)/32);
+ memset(bm->b, 0, sizeof(uint32)*((n+31)/32));
return bm;
}
@@ -92,7 +92,7 @@ int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src)
int count = MIN(dst->n, src->n);
SMB_ASSERT(dst->b != src->b);
- memcpy(dst->b, src->b, sizeof(dst->b[0])*(count+31)/32);
+ memcpy(dst->b, src->b, sizeof(uint32)*((count+31)/32));
return count;
}