Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/lib/bitmap.c

    r414 r740  
    2424
    2525/****************************************************************************
    26 allocate a bitmap of the specified size
    27 ****************************************************************************/
    28 struct bitmap *bitmap_allocate(int n)
    29 {
    30         struct bitmap *bm;
    31 
    32         bm = SMB_MALLOC_P(struct bitmap);
    33 
    34         if (!bm) return NULL;
    35 
    36         bm->n = n;
    37         bm->b = SMB_MALLOC_ARRAY(uint32, (n+31)/32);
    38         if (!bm->b) {
    39                 SAFE_FREE(bm);
    40                 return NULL;
    41         }
    42 
    43         memset(bm->b, 0, sizeof(uint32)*((n+31)/32));
    44 
    45         return bm;
    46 }
    47 
    48 /****************************************************************************
    49 free a bitmap.
    50 ****************************************************************************/
    51 
    52 void bitmap_free(struct bitmap *bm)
    53 {
    54         if (!bm)
    55                 return;
    56 
    57         SAFE_FREE(bm->b);
    58         SAFE_FREE(bm);
    59 }
    60 
    61 /****************************************************************************
    6226talloc a bitmap
    6327****************************************************************************/
     
    6630        struct bitmap *bm;
    6731
    68         if (!mem_ctx) return NULL;
    69 
    7032        bm = TALLOC_P(mem_ctx, struct bitmap);
    7133
     
    7335
    7436        bm->n = n;
    75         bm->b = TALLOC_ARRAY(mem_ctx, uint32, (n+31)/32);
     37        bm->b = TALLOC_ZERO_ARRAY(bm, uint32, (n+31)/32);
    7638        if (!bm->b) {
     39                TALLOC_FREE(bm);
    7740                return NULL;
    7841        }
    79 
    80         memset(bm->b, 0, sizeof(uint32)*((n+31)/32));
    81 
    8242        return bm;
    8343}
Note: See TracChangeset for help on using the changeset viewer.