| 262 | |
| 263 | |
| 264 | int uriCompleteMemoryManager(UriMemoryManager * memory, |
| 265 | UriMemoryManager * backend) { |
| 266 | if ((memory == NULL) || (backend == NULL)) { |
| 267 | return URI_ERROR_NULL; |
| 268 | } |
| 269 | |
| 270 | if ((backend->malloc == NULL) || (backend->free == NULL)) { |
| 271 | return URI_ERROR_MEMORY_MANAGER_INCOMPLETE; |
| 272 | } |
| 273 | |
| 274 | memory->calloc = uriEmulateCalloc; |
| 275 | memory->reallocarray = uriEmulateReallocarray; |
| 276 | |
| 277 | memory->malloc = uriDecorateMalloc; |
| 278 | memory->realloc = uriDecorateRealloc; |
| 279 | memory->free = uriDecorateFree; |
| 280 | |
| 281 | memory->userData = backend; |
| 282 | |
| 283 | return URI_SUCCESS; |
| 284 | } |
| 285 | |
| 286 | |
| 287 | |