Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include "plugin.h"
  2. void *util_alloc(size_t sz)
  3. {
  4.     static size_t bytes_left;
  5.     void *plugin_buffer = rb->plugin_get_buffer(&bytes_left);
  6.     if(plugin_buffer)
  7.     {
  8.         void *ret = plugin_buffer;
  9.         plugin_buffer += sz;
  10.         if((signed long) bytes_left - (signed long) sz < 0)
  11.         {
  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