src/kernel/object/object.c
/**
 * @note alloc and init a new dynamic object from heap
 * @param type
 * @return  NULL when fail
 *          new object ptr when successful
 */
@note alloc and init a new dynamic object from heap
@param type
@return  NULL when fail
new object ptr when successful
@note alloc and init a new dynamic object from heap @param type @return NULL when fail new object ptr when successful
object_t * object_new(object_type_t type,...){
    size_t object_size = g_obj_size[type];
    object_t * object;
    if(object_size<MAX_OBJECT_SIZE_FORM_HEAP){
        object = heap_kalloc(object_size);
    }
    else{
        object = kalloc(object_size/PAGE_SIZE);
    }
    if(object != NULL){
        _object_init_raw(object, type, _object_id_gen(type), OBJECT_FLAG_DYNAMIC);
        va_list vp;
        va_start(vp,type);
        g_obj_vtbls[type].create(object,vp);
    }
    return object;
}
object_t * object_new ( object_type_t type , ... ) { size_t object_size = g_obj_size [ type ] ; object_t * object ; if ( object_size < MAX_OBJECT_SIZE_FORM_HEAP ) { object = heap_kalloc ( object_size ) ; } else { object = kalloc ( object_size / PAGE_SIZE ) ; } if ( object != NULL ) { _object_init_raw ( object , type , _object_id_gen ( type ) , OBJECT_FLAG_DYNAMIC ) ; va_list vp ; va_start ( vp , type ) ; g_obj_vtbls [ type ] . create ( object , vp ) ; } return object ; }
@note alloc and init a new dynamic object from heap
 @param type
 @return  NULL when fail
          new object ptr when successful
@note alloc and init a new dynamic object from heap @param type @return NULL when fail new object ptr when successful
// init object and add to container.