summaryrefslogtreecommitdiff
path: root/source/lib/bitmap.c
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-12-16 12:30:49 +0000
committerGerald Carter <jerry@samba.org>2004-12-16 12:30:49 +0000
commit8d91e07ef22ad3ed484b04bc4968380a24940696 (patch)
treeb5b8989f8da9ef7f852081f0460995386edd4b5d /source/lib/bitmap.c
parent1a878c865637feb80206c0dc599acebf7f4a46bd (diff)
downloadsamba-8d91e07ef22ad3ed484b04bc4968380a24940696.tar.gz
r4231: commiting changes to 3.0.10samba-3.0.10
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;
}