Example #1
0
File: action.c Project: fxstein/sky
// Creates a reference to an action.
// 
// Returns a reference to the new action if successful.
sky_action *sky_action_create()
{
    sky_action *action = calloc(sizeof(*action), 1); check_mem(action);
    return action;
    
error:
    sky_action_free(action);
    return NULL;
}
Example #2
0
// Unloads the actions in the action file from memory.
//
// action_file - The action file to save.
//
// Returns 0 if successful, otherwise returns -1.
int sky_action_file_unload(sky_action_file *action_file)
{
    if(action_file) {
        // Release actions.
        if(action_file->actions) {
            uint32_t i=0;
            for(i=0; i<action_file->action_count; i++) {
                sky_action *action = action_file->actions[i];
                sky_action_free(action);
                action_file->actions[i] = NULL;
            }
            free(action_file->actions);
            action_file->actions = NULL;
        }
        
        action_file->action_count = 0;
    }
    
    return 0;
}