Changeset 919 for vendor/current/source3/lib
- Timestamp:
- Jun 9, 2016, 2:17:22 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/lib/bitmap.c
r917 r919 19 19 20 20 #include "includes.h" 21 #include "lib/util/bitmap.h" 21 22 22 23 /* these functions provide a simple way to allocate integers from a … … 30 31 struct bitmap *bm; 31 32 32 bm = TALLOC_P(mem_ctx, struct bitmap);33 bm = talloc_zero(mem_ctx, struct bitmap); 33 34 34 35 if (!bm) return NULL; 35 36 36 37 bm->n = n; 37 bm->b = TALLOC_ZERO_ARRAY(bm, uint32, (n+31)/32);38 bm->b = talloc_zero_array(bm, uint32_t, (n+31)/32); 38 39 if (!bm->b) { 39 40 TALLOC_FREE(bm); … … 52 53 53 54 SMB_ASSERT(dst->b != src->b); 54 memcpy(dst->b, src->b, sizeof(uint32 )*((count+31)/32));55 memcpy(dst->b, src->b, sizeof(uint32_t)*((count+31)/32)); 55 56 56 57 return count; … … 65 66 DEBUG(0,("Setting invalid bitmap entry %d (of %d)\n", 66 67 i, bm->n)); 67 return False;68 return false; 68 69 } 69 70 bm->b[i/32] |= (1<<(i%32)); 70 return True;71 return true; 71 72 } 72 73 … … 79 80 DEBUG(0,("clearing invalid bitmap entry %d (of %d)\n", 80 81 i, bm->n)); 81 return False;82 return false; 82 83 } 83 84 bm->b[i/32] &= ~(1<<(i%32)); 84 return True;85 return true; 85 86 } 86 87 … … 90 91 bool bitmap_query(struct bitmap *bm, unsigned i) 91 92 { 92 if (i >= bm->n) return False;93 if (i >= bm->n) return false; 93 94 if (bm->b[i/32] & (1<<(i%32))) { 94 return True;95 return true; 95 96 } 96 return False;97 return false; 97 98 } 98 99
Note:
See TracChangeset
for help on using the changeset viewer.