Commit e8ec1b55 by Sergey.Kolodchenko

Upload New File

parent e19dcab4
Showing with 23 additions and 0 deletions
ccv_array_t* ccv_array_new (int rsize, int rnum, uint64_t sig) {
ccv_array_t* array;
if (ccv_cache_opt && sig != 0) {
uint8_t type;
array = (ccv_array_t*)
ccv_cache_out(&ccv_cache, sig, &type);
if (array){
assert(type == 1);
array->type |= CCV_GARBAGE;
array->refcount = 1;
return array;
}
}
array = (ccv_array_t*)ccmalloc(sizeof(ccv_array_t));
array->sig = sig;
array->type = CCV_REUSABLE & ~CCV_GARBAGE;
array->rnum = 0;
array->rsize = rsize;
array->size = ccv_max(rnum, 2 /* allocate memory for at least 2 items */);
array->data = ccmalloc((size_t)array->size * (size_t)rsize);
return array;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment