Changeset 988 for vendor/current/lib/util/bitmap.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/lib/util/bitmap.c
r921 r988 21 21 #include "lib/util/bitmap.h" 22 22 23 struct bitmap { 24 unsigned int n; 25 uint32_t b[1]; /* We allocate more */ 26 }; 27 23 28 /* these functions provide a simple way to allocate integers from a 24 29 pool without repetition */ … … 31 36 struct bitmap *bm; 32 37 33 bm = talloc_zero(mem_ctx, struct bitmap); 38 bm = (struct bitmap *)talloc_zero_size( 39 mem_ctx, 40 offsetof(struct bitmap, b) + sizeof(uint32_t)*((n+31)/32)); 34 41 35 42 if (!bm) return NULL; 36 43 44 talloc_set_name_const(bm, "struct bitmap"); 45 37 46 bm->n = n; 38 bm->b = talloc_zero_array(bm, uint32_t, (n+31)/32);39 if (!bm->b) {40 TALLOC_FREE(bm);41 return NULL;42 }43 47 return bm; 44 48 }
Note:
See TracChangeset
for help on using the changeset viewer.