Advertisement
Guest User

4a

a guest
Jun 27th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include "4a.h"
  2. #include <stdio.h> /* NULL */
  3. #include <stdlib.h>
  4.  
  5. void buddy_free(void *addr)
  6. {
  7.     if(addr == NULL)return;
  8.     node_t node = (node_t)addr;
  9.    
  10.  
  11.     bst_dump();
  12.     printf("start: %d\n", (int)node);
  13.  
  14.     while(*node == NODE_FREE){
  15.         //printf("start: %c\n", (char)*node);
  16.         //printf("start: %c\n", (char)NODE_FREE);
  17.         node_t par = bst_parent(node);
  18.         if(par != NULL){
  19.             node = par;
  20.         }else{
  21.             printf("WRONG ADRESS!\n");
  22.             exit(255);
  23.         }
  24.     }
  25.     *node = NODE_FREE;
  26.     bst_housekeeping(bst_root());
  27.        
  28.     bst_dump();
  29.     memory_dump();
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement