diff options
Diffstat (limited to 'stalloc.c')
-rw-r--r-- | stalloc.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,4 +1,5 @@ #include <stdlib.h> +#include <string.h> static int nb_pools = 0; static char ** mem_pools = 0; @@ -41,13 +42,13 @@ void * st_alloc(size_t s) { pools_size[pool] += s; - return mem_pools[pool] + pool_size[pool] - s; + return mem_pools[pool] + pools_size[pool] - s; } char * st_strdup(const char * src) { int s = strlen(src) + 1; - char * r = (char *) st_alloc(s) - memcpy(r, src); + char * r = (char *) st_alloc(s); + memcpy(r, src, s); return r; } |