Advertisement
Guest User

Untitled

a guest
Dec 7th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. struct chunk* get_chunk(void *p)
  2. {
  3.     if(p == NULL)
  4.         return NULL;
  5.     /*if((char*)p % sizeof(size_t) != 0)
  6.         return NULL;*/
  7.     struct chunk *base = get_base();
  8.     /* if((struct chunk*)p < base || p > sbrk(0))
  9.         return NULL;*/
  10.     while(base != NULL && base->data != p)
  11.     {
  12.         base = base->next;
  13.     }
  14.     if(base == NULL || base->free == 0)
  15.         return NULL;
  16.     return base;
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement