Guest User

Untitled

a guest
Oct 7th, 2015
149
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void *util_alloc(size_t sz)
  2. {
  3. static size_t bytes_left;
  4. static void *plugin_buffer = rb->plugin_get_buffer(&bytes_left);
  5. if(plugin_buffer)
  6. {
  7. void *ret = plugin_buffer;
  8. plugin_buffer += sz;
  9. if((signed long) bytes_left - (signed long) sz < 0)
  10. {
  11. error("Im all outta memoriez!!! :(");
  12. return NULL;
  13. }
  14. bytes_left -= sz;
  15. return ret;
  16. }
  17. else
  18. {
  19. return NULL;
  20. }
  21. }
RAW Paste Data