| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #include <string.h> /* for strlen */ |
| #include "mpc-impl.h" |
| |
| char * |
| mpc_alloc_str (size_t len) |
| { |
| void * (*allocfunc) (size_t); |
| mp_get_memory_functions (&allocfunc, NULL, NULL); |
| return (char *) ((*allocfunc) (len)); |
| } |
| |
| char * |
| mpc_realloc_str (char * str, size_t oldlen, size_t newlen) |
| { |
| void * (*reallocfunc) (void *, size_t, size_t); |
| mp_get_memory_functions (NULL, &reallocfunc, NULL); |
| return (char *) ((*reallocfunc) (str, oldlen, newlen)); |
| } |
| |
| void |
| mpc_free_str (char *str) |
| { |
| void (*freefunc) (void *, size_t); |
| mp_get_memory_functions (NULL, NULL, &freefunc); |
| (*freefunc) (str, strlen (str) + 1); |
| } |