Instead of using: | Use: |
---|---|
_resmgr_handle_grow() | resmgr_handle_grow() |
_resmgr_io_func() | resmgr_iofuncs() |
_resmgr_ocb() | resmgr_ocb() (Note that this function takes only one argument, a pointer to a resmgr_context_t structure.) |
Function | Default | V | R |
---|---|---|---|
calloc(n, 0) | Non-NULL | NULL | No effect |
malloc(0) | Non-NULL | NULL | No effect |
realloc(NULL, 0) | Non-NULL | NULL | No effect |
realloc(non-NULL, 0) | Non-NULL | NULL | NULL |
In all the above cases, if the function returns a non-NULL pointer, it's valid only for a corresponding call to free() or realloc().
The resmgr_attach() function copies the pointers to the resmgr_connect_funcs_t and resmgr_io_funcs_t structures, not the structures themselves. You should allocate the structures, declare them to be static, or make them global variables. If your resource manager is for more than one device with different handlers, create separate structures that define the handlers.