Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement