Advertisement
Guest User

Untitled

a guest
Oct 10th, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. int memory_free(void *valid_ptr)
  2. {
  3. int i;
  4. int j;
  5. for (i = 2; i < ptr_memory[0]; )
  6. {
  7. if(valid_ptr == &ptr_memory[i+1])
  8. {
  9. // pospaja volne bloky smerom dopredu
  10. j = i + ptr_memory[i] + 2;
  11. if (ptr_memory[j - 1] == 0)
  12. {
  13. ptr_memory[i] = ptr_memory[i] + ptr_memory[j] + 2;
  14. j = j + ptr_memory[i] + 2;
  15.  
  16. if (j < (ptr_memory[0] - 2))
  17. {
  18. continue;
  19. }
  20. }
  21. // pospaja volne bloky smerom dopredu
  22. ptr_memory[i-1] = 0;
  23. return 0;
  24. }
  25. else
  26. {
  27. i = i + ptr_memory[i] + 2;
  28. }
  29. }
  30. return 1;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement