mspace versions of routines are near-clones of the global versions. This is not so nice but better than the alternatives. */
| 4934 | versions. This is not so nice but better than the alternatives. |
| 4935 | */ |
| 4936 | void* mspace_malloc(mspace msp, size_t bytes) { |
| 4937 | void *mem; |
| 4938 | mstate ms = (mstate)msp; |
| 4939 | size_t nb = 0; |
| 4940 | |
| 4941 | if (!ok_magic(ms)) { |
| 4942 | USAGE_ERROR_ACTION(ms,ms); |
| 4943 | return 0; |
| 4944 | } |
| 4945 | |
| 4946 | if (!PREACTION(ms)) { |
| 4947 | mem = alloc_from_reserved_mem(ms, bytes, &nb); |
| 4948 | if (mem == NULL) |
| 4949 | mem = sys_alloc(ms, nb, 0); |
| 4950 | POSTACTION(ms); |
| 4951 | } |
| 4952 | return mem; |
| 4953 | } |
| 4954 | |
| 4955 | void mspace_free(mspace msp, void* mem) { |
| 4956 | if (mem != 0) { |
no test coverage detected