compat.c 546 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * fs kernel compatibility hacks for drivers from the cpu/terminal kernel
  3. */
  4. #include "all.h"
  5. #include "io.h"
  6. #include "mem.h"
  7. #include "compat.h"
  8. void
  9. free(void *p) /* there's a struct member named "free". sigh. */
  10. {
  11. USED(p);
  12. }
  13. void *
  14. mallocz(ulong sz, int clr)
  15. {
  16. void *p = malloc(sz);
  17. if (clr && p != nil)
  18. memset(p, '\0', sz);
  19. return p;
  20. }
  21. void
  22. freeb(Block *b)
  23. {
  24. mbfree(b);
  25. }
  26. /*
  27. * free a list of blocks
  28. */
  29. void
  30. freeblist(Block *b)
  31. {
  32. Block *next;
  33. for(; b != 0; b = next){
  34. next = b->next;
  35. b->next = 0;
  36. freeb(b);
  37. }
  38. }