Exemplo n.º 1
0
/* Free texture */
int dlFreeTexture( dlTexture *obj )
{
   CALL("%p", obj);

   /* non valid */
   if(!obj)
   { RET("%d", RETURN_NOTHING); return( RETURN_NOTHING ); }

   /* There is still references to this object alive */
   if(--obj->refCounter != 0) { RET("%d", RETURN_NOTHING); return( RETURN_NOTHING ); }

   LOGFREEP("FREE %dx%d %.2f MiB", obj->width, obj->height, (float)obj->size / 1048576);

   /* remove from cache */
   dlTextureRemoveCache( obj );
   dlSetAlloc( ALLOC_TEXTURE );

   /* delete Odl texture if there is one */
   if(obj->object)   glDeleteTextures( 1, &obj->object );
   if(obj->data)     dlFree(obj->data, obj->size);
   if(obj->file)     free(obj->file);

   /* free */
   dlFree( obj, sizeof( dlTexture ) );

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 2
0
/* free texture */
int dlAtlasFreeTexture( dlAtlas *atlas, dlTexture *texture )
{
   unsigned int i, found;
   dlAtlasRect *tmp;
   CALL("%p, %p", atlas, texture);

   if(!atlas)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }
   if(!atlas->rect)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }
   if(!texture)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   dlSetAlloc( ALLOC_ATLAS );

   /* allocate tmp list */
   tmp = dlCalloc( atlas->num_textures, sizeof(dlAtlasRect) );
   if(!tmp)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   /* add everything expect the one we are looking for to tmp list */
   i = 0;
   found = 0;
   for(; i != atlas->num_textures; ++i)
   {
      if( atlas->rect[i].texture != texture )
      {
         tmp[++found] = atlas->rect[i];
      }
   }

   if(found)
   {
      /* resize list */
      tmp = dlRealloc( tmp, atlas->num_textures, found, sizeof(dlAtlasRect) );
      if(!tmp)
      { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }
   }
   else
   {
      dlFree( tmp, atlas->num_textures * sizeof(dlAtlasRect) );
      tmp = NULL;
   }

   /* ok, free the old list */
   dlFree( atlas->rect, atlas->num_textures * sizeof(dlAtlasRect) );
   dlFreeTexture( texture );

   /* use the new list and new count */
   atlas->rect           = tmp;
   atlas->num_textures   = found;

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 3
0
/* remove texture from cache */
int dlTextureRemoveCache( dlTexture *texture )
{
   unsigned int i, found;
   dlTexture **tmp;
   CALL("%p", texture);

   if(!texture)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }
   if(!texture->file)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   if(!_DL_TEXTURE_CACHE.num_textures)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   dlSetAlloc( ALLOC_TEXTURE_CACHE );
   tmp = dlCalloc( _DL_TEXTURE_CACHE.num_textures, sizeof(dlTexture*) );
   if(!tmp)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   /* add everything expect the one we are looking for to tmp list */
   i = 0;
   found = 0;
   for(; i != _DL_TEXTURE_CACHE.num_textures; ++i)
   {
      if( _DL_TEXTURE_CACHE.texture[i] == texture )
      {
         tmp[found++] = _DL_TEXTURE_CACHE.texture[i];
      }
   }

   if(found)
   {
      /* resize list */
      tmp = dlRealloc( tmp, _DL_TEXTURE_CACHE.num_textures, found, sizeof(dlTexture*) );
      if(!tmp)
      { RET("%d", RETURN_FAIL);  return( RETURN_FAIL ); }
   }
   else
   {
      /* free */
      dlFree( tmp,  _DL_TEXTURE_CACHE.num_textures * sizeof(dlTexture*) );
      tmp = NULL;
   }

   /* ok, free the old list */
   dlFree( _DL_TEXTURE_CACHE.texture, _DL_TEXTURE_CACHE.num_textures * sizeof(dlTexture*) );

   /* use the new list and new count */
   _DL_TEXTURE_CACHE.texture      = tmp;
   _DL_TEXTURE_CACHE.num_textures = found;

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 4
0
/* Free scene object */
int dlFreeObject( dlObject *object )
{
   unsigned int i;
   CALL("%p", object);

   /* Fuuuuuuuuu--- We have non valid object */
   if(!object) { RET("%d", RETURN_NOTHING); return( RETURN_NOTHING ); }

   /* Free material ( if any ) */
   if(dlFreeMaterial( object->material ) == RETURN_OK)
      object->material = NULL;

   /* Free VBO Object */
   if(dlFreeVBO( object->vbo )           == RETURN_OK)
      object->vbo = NULL;

   /* Free IBO Object */
   if(dlFreeIBO( object->ibo )           == RETURN_OK)
      object->ibo = NULL;

   /* free animator if there is one */
   if(object->animator)
   { if( dlFreeAnimator( object->animator ) == RETURN_OK ); object->animator = NULL; }

   /* Free as in, decrease reference on childs */
   i = 0;
   for(; i != object->num_childs; ++i)
   {
      if(dlFreeObject( object->child[i] ) == RETURN_OK)
         object->child[i] = NULL;
   }

   /* There is still references to this object alive */
   if(--object->refCounter != 0) return( RETURN_NOTHING );

   dlSetAlloc( ALLOC_SCENEOBJECT );

   /* Free child list */
   dlFree( object->child, object->num_childs * sizeof(dlObject*) );
   object->child = NULL;
   object->num_childs = 0;

   LOGFREE("FREE");

   /* Free scene object */
   dlFree( object, sizeof(dlObject) );

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 5
0
/* Free IBO object */
int dlFreeIBO( dlIBO *ibo )
{
   CALL("%p", ibo);

   /* Fuuuuuuuuu--- We have non valid object */
   if(!ibo) { RET("%d", RETURN_NOTHING); return( RETURN_NOTHING ); }

   /* There is still references to this object alive */
   if(--ibo->refCounter != 0) { RET("%d", RETURN_NOTHING); return( RETURN_NOTHING ); }

   dlSetAlloc( ALLOC_IBO );

   /* Free all data */
   dlFreeIndexBuffer( ibo );

   /* delete ibo */
   if( ibo->object ) glDeleteBuffers(1, &ibo->object);
   ibo->object = 0;

   LOGFREE("FREE");

   /* Free IBO object */
   dlFree( ibo, sizeof(dlIBO) );

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 6
0
/* Free all childs */
int dlObjectFreeChilds( dlObject *object )
{
   unsigned int i;
   CALL("%p", object);

   if(!object)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }
   if(!object->child)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   /* free all */
   i = 0;
   for(; i != object->num_childs; ++i)
   {
      if( dlFreeObject( object->child[i] ) == RETURN_OK )
         object->child[i] = NULL;
   }

   dlSetAlloc( ALLOC_SCENEOBJECT );
   dlFree( object->child, object->num_childs * sizeof(dlObject*) );
   object->child = NULL;
   object->num_childs = 0;

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 7
0
/* free textures */
int dlAtlasFreeTextures( dlAtlas *atlas )
{
   unsigned int i;
   CALL("%p", atlas);

   if(!atlas)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }
   if(!atlas->rect)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   /* free all */
   i = 0;
   for(; i != atlas->num_textures; ++i)
   {
      if( dlFreeTexture( atlas->rect[i].texture ) == RETURN_OK )
         atlas->rect[i].texture = NULL;
   }

   /* free */
   dlSetAlloc( ALLOC_ATLAS );
   dlFree( atlas->rect, atlas->num_textures * sizeof(dlAtlasRect) );
   atlas->rect         = NULL;
   atlas->num_textures = 0;

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 8
0
int dlFreeAnimTick( dlAnimTick *animTick )
{
   dlAnimTickOldNode    *oldNode, *nextOldNode;
   dlNodeAnim           *node;
   CALL("%p", animTick);

   /* invalid object */
   if(!animTick)
   { RET("%d", RETURN_NOTHING); return( RETURN_NOTHING ); }

   dlSetAlloc( ALLOC_EVALUATOR );

   /* we should have animation */
   if(animTick->anim)
   {
      /* free nodes */
      oldNode = animTick->oldNode;
      node    = animTick->anim->node;
      while(oldNode)
      {
         /* free stored pointers */
         dlFree( oldNode->translation,
                 node->num_translation * sizeof(dlVectorKey*) );
         dlFree( oldNode->rotation,
                 node->num_rotation    * sizeof(dlQuatKey*)   );
         dlFree( oldNode->scaling,
                 node->num_scaling     * sizeof(dlVectorKey*) );

         node = node->next;

         /* free node */
         nextOldNode = oldNode->next;
         dlFree( oldNode, sizeof(dlAnimTickOldNode) );
         oldNode = nextOldNode;
      }
      animTick->oldNode = NULL;
   }

   LOGFREE("FREE");

   /* free ticker */
   dlFree( animTick, sizeof(dlAnimTick) );
   animTick = NULL;

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 9
0
/* Free VBO object */
int dlFreeVBO( dlVBO *vbo )
{
   unsigned int i;
   CALL("%p", vbo);

   /* Fuuuuuuuuu--- We have non valid object */
   if(!vbo) { RET("%d", RETURN_NOTHING); return( RETURN_NOTHING ); }

   /* There is still references to this object alive */
   if(--vbo->refCounter != 0) { RET("%d", RETURN_NOTHING); return( RETURN_NOTHING ); }

   dlSetAlloc( ALLOC_VBO );

   /* Free all data */
   i = 0;
   for(;i != _dlCore.info.maxTextureUnits; ++i)
      dlFreeCoordBuffer( vbo, i );
   dlFree( vbo->uvw, _dlCore.info.maxTextureUnits * sizeof(dlUVW) );

   if(vbo->tstance) free(vbo->tstance);
   dlFreeVertexBuffer( vbo );
   dlFreeNormalBuffer( vbo );
#if VERTEX_COLOR
   dlFreeColorBuffer( vbo );
#endif

   /* delete vbo */
   if( vbo->object ) glDeleteBuffers(1, &vbo->object);
   vbo->object = 0;

   LOGFREE("FREE");

   /* Free VBO object */
   dlFree( vbo, sizeof(dlVBO) );

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 10
0
/**
 * @brief 	Free chunkmem block.
 * @param 	addr [in] start address of chunkmem block to free,
 *  			kernel_addr.
 * @return  None
 * @see 	dlFree
 */
void gp_chunk_free(void *addr)
{
	if (chunkmem != NULL) {
		if (down_interruptible(&chunkmem->sem) == 0) {
			#if DEBUG_ALLOC_FREE
			DIAG_DEBUG("++++++++++++++++++++++++ FREE ++++++++++++++++++++++++++\n");
			DIAG_DEBUG("!!!!addr = %08X\n", (unsigned long)addr);
			dlMalloc_Status(NULL);
			#endif
#if (DIAG_LEVEL >= DIAG_LVL_VERB) && !defined(DIAG_VERB_OFF)
			int ret = dlFree(addr);
#else
			dlFree(addr);
#endif
			#if DEBUG_ALLOC_FREE
			dlMalloc_Status(NULL);
			DIAG_DEBUG("------------------------ FREE --------------------------\n");
			#endif
			up(&chunkmem->sem);
			DIAG_VERB("dlFree: %d\n", ret);
		}
	}
}
Exemplo n.º 11
0
int dlFreeIndexBuffer( dlIBO *ibo )
{
#if USE_BUFFERS
   unsigned int i;
#endif

   CALL("%p", ibo);

   if(!ibo)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   dlSetAlloc( ALLOC_IBO );

#if USE_BUFFERS
   i = 0;
   for(;i != DL_MAX_BUFFERS; ++i)
   {
      dlFree( ibo->indices[i], ibo->i_num[i] * sizeof(unsigned short) );
      ibo->indices[i] = NULL;

      ibo->i_num[i] = 0;
      ibo->i_use[i] = 0;
   }
#else
   dlFree( ibo->indices, ibo->i_num * sizeof(unsigned int) );
   ibo->indices = NULL;

   ibo->i_num = 0;
   ibo->i_use = 0;
#endif

   /* mark IBO as outdated */
   ibo->up_to_date = 0;

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 12
0
/* free atlas */
int dlFreeAtlas( dlAtlas *atlas )
{
   unsigned int i;
   CALL("%p", atlas);

   /* non valid */
   if(!atlas)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   /* Free as in, decrease reference on childs */
   i = 0;
   for(; i != atlas->num_textures; ++i)
   {
      if(dlFreeTexture( atlas->rect[i].texture ) == RETURN_OK)
         atlas->rect[i].texture = NULL;
   }

   /* Free combined atlas texture */
   dlFreeTexture( atlas->texture );

   /* still hold reference? */
   if(--atlas->refCounter != 0)
   { RET("%d", RETURN_NOTHING); return( RETURN_NOTHING ); }

   dlSetAlloc( ALLOC_ATLAS );

   /* free everything */
   dlFree( atlas->rect, atlas->num_textures * sizeof(dlAtlasRect) );
   atlas->rect          = NULL;
   atlas->num_textures  = 0;

   LOGFREE("FREE");
   dlFree( atlas, sizeof(dlAtlas) );

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 13
0
/* Free texture cache */
int dlTextureFreeCache( void )
{
   TRACE();

   if(!_DL_TEXTURE_CACHE.texture)
   { RET("%d", RETURN_OK); return( RETURN_OK ); }

   /* free */
   dlSetAlloc( ALLOC_TEXTURE_CACHE );
   dlFree( _DL_TEXTURE_CACHE.texture, _DL_TEXTURE_CACHE.num_textures * sizeof(dlTexture*) );
   _DL_TEXTURE_CACHE.texture = NULL;

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 14
0
/* Copy VBO object */
dlVBO* dlCopyVBO( dlVBO *src )
{
   unsigned int i = 0;
   dlVBO *vbo;
   CALL("%p", src);

   /* Fuuuuuuuuu--- We have non valid object */
   if(!src) { RET("%p", NULL); return( NULL ); }

   /* Allocate VBO object */
   dlSetAlloc( ALLOC_VBO );
   vbo = (dlVBO*)dlCalloc( 1, sizeof(dlVBO) );
   if(!vbo)
   { RET("%p", NULL); return( NULL ); }

   /* Allocate uvws */
   vbo->uvw = dlCalloc( _dlCore.info.maxTextureUnits, sizeof(dlUVW) );
   if(!vbo->uvw)
   {
      dlFree(vbo, sizeof(dlVBO));

      RET("%p", NULL);
      return( NULL );
   }

   /* Copy data */
   for(;i != _dlCore.info.maxTextureUnits; ++i)
      dlCopyCoordBuffer( vbo, src, i );

   dlCopyVertexBuffer( vbo, src );
   dlCopyNormalBuffer( vbo, src );
#if VERTEX_COLOR
   dlCopyColorBuffer( vbo, src );
#endif
   if(src->tstance) dlVBOPrepareTstance( vbo );

   vbo->vbo_size  = src->vbo_size;
   vbo->hint      = src->hint;

   LOGWARN("COPY");

   /* Increase ref counter */
   vbo->refCounter++;

   /* Return VBO object */
   RET("%p", vbo);
   return( vbo );
}
Exemplo n.º 15
0
/* Allocate VBO object */
dlVBO* dlNewVBO( void )
{
   unsigned int i;

   /* Allocate VBO object */
   dlSetAlloc( ALLOC_VBO );
   dlVBO *vbo = (dlVBO*)dlCalloc( 1, sizeof(dlVBO) );
   if(!vbo)
   { RET("%p", NULL); return( NULL ); }

   /* Default hint */
   vbo->hint = GL_STATIC_DRAW;

   /* Allocate uvws */
   vbo->uvw = dlCalloc( _dlCore.info.maxTextureUnits, sizeof(dlUVW) );
   if(!vbo->uvw)
   {
      dlFree(vbo, sizeof(dlVBO));

      RET("%p", NULL);
      return( NULL );
   }

   /* Nullify pointers */
   i = 0;
   for(; i != _dlCore.info.maxTextureUnits; ++i)
      vbo->uvw[i].coords  = NULL;

   vbo->tstance   = NULL;
   vbo->vertices  = NULL;
   vbo->normals   = NULL;
#if VERTEX_COLOR
   vbo->colors    = NULL;
#endif


   LOGOK("NEW");

   /* Increase ref counter */
   vbo->refCounter++;

   /* Return VBO object */
   RET("%p", vbo);
   return( vbo );
}
Exemplo n.º 16
0
int dlFreeVertexBuffer( dlVBO *vbo )
{
   CALL("%p", vbo);

   if(!vbo)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   dlSetAlloc( ALLOC_VBO );

   dlFree( vbo->vertices, sizeof(kmVec3) * vbo->v_num );
   vbo->vertices = NULL;
   vbo->v_num = 0;
   vbo->v_use = 0;

   /* Mark vbo outdated */
   vbo->up_to_date = 0;

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 17
0
int dlFreeNormalBuffer( dlVBO *vbo )
{
   CALL("%p", vbo);

   if(!vbo)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   dlSetAlloc( ALLOC_VBO );

   dlFree( vbo->normals, vbo->n_num * sizeof(kmVec3) );
   vbo->normals = NULL;
   vbo->n_use = 0;
   vbo->n_num = 0;

   /* Mark vbo outdated */
   vbo->up_to_date = 0;

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 18
0
int dlFreeColorBuffer( dlVBO *vbo )
{
   CALL("%p", vbo);

   if(!vbo)
   { RET("%d", vbo); return( RETURN_FAIL ); }

   dlSetAlloc( ALLOC_VBO );

   dlFree( vbo->colors, vbo->c_num * sizeof(dlColor) );
   vbo->colors = NULL;
   vbo->c_num = 0;
   vbo->c_use = 0;

   /* mark VBO outdated */
   vbo->up_to_date = 0;

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 19
0
/* Create GL Texture manually.
 * Flags are SOIL flags */
int dlTextureCreate( dlTexture *texture, unsigned char *data,
      int width, int height, int channels, unsigned int flags )
{
   CALL("%p, %u, %d, %d, %d, %u", texture, data,
         width, height, channels, flags);

   if(!texture)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   dlSetAlloc( ALLOC_TEXTURE );

   /* Create dl texture */
   if(texture->object)  glDeleteTextures( 1, &texture->object );
   if(texture->data)    dlFree(texture->data, texture->size);

   texture->object =
   SOIL_create_OGL_texture(
      data, width, height, channels,
      0,
      flags );

   texture->width    = width;
   texture->height   = height;
   texture->channels = channels;
   texture->data     = data;
   texture->size     = width * height * channels;

#ifdef DEBUG
   /* to keep with statistics */
   dlFakeAlloc( texture->size );
#endif

   if(!texture->object)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   LOGWARNP("NEW %dx%d %.2f MiB", texture->width, texture->height, (float)texture->size / 1048576);

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 20
0
/* Free camera */
int dlFreeCamera( dlCamera *object )
{
   CALL("%p", object);

   /* Fuuuuuuuuu--- We have non valid object */
   if(!object) { RET("%d", RETURN_NOTHING); return( RETURN_NOTHING ); }

   /* There is still references to this object alive */
   if(--object->refCounter != 0) { RET("%d", RETURN_NOTHING); return( RETURN_NOTHING ); }

   dlSetAlloc( ALLOC_CAMERA );

   /* Check if this is active */
   if(dlGetCamera() == object)
      dlSetCamera( NULL );

   LOGFREE("FREE");

   /* Free camera */
   dlFree( object, sizeof(dlCamera) );
   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 21
0
int dlFreeCoordBuffer( dlVBO *vbo, unsigned int index )
{
   CALL("%p, %u", vbo, index);

   if(!vbo)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   if(index > _dlCore.info.maxTextureUnits)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   dlSetAlloc( ALLOC_VBO );

   if( vbo->uvw[index].coords )
      dlFree( vbo->uvw[index].coords, sizeof(kmVec2) * vbo->uvw[index].c_num );
   vbo->uvw[index].coords    = NULL;
   vbo->uvw[index].c_use = 0;
   vbo->uvw[index].c_num = 0;

   /* Mark vbo outdated */
   vbo->up_to_date = 0;

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 22
0
/* Free material object */
int dlFreeMaterial( dlMaterial *object )
{
   CALL("%p", object);

   /* Fuuuuuuuuu--- We have non valid object */
   if(!object) { RET("%d", RETURN_NOTHING); return( RETURN_NOTHING ); }

   /* Free texture */
   if(dlFreeTexture( object->texture ) == RETURN_OK)
      object->texture = NULL;

   /* There is still references to this object alive */
   if(--object->refCounter != 0) { RET("%d", RETURN_NOTHING); return( RETURN_NOTHING ); }

   dlSetAlloc( ALLOC_MATERIAL );

   LOGFREE("FREE");

   /* Free scene object */
   dlFree( object, sizeof(dlMaterial) );

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}
Exemplo n.º 23
0
/* Free child */
int dlObjectFreeChild( dlObject *object, dlObject *child )
{
   unsigned int i;
   unsigned int found;
   dlObject     **tmp, **tmp2;

   CALL("%p, %p", object, child);

   if(!object)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }
   if(!child)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }
   if(!object->child)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   /* allocate tmp list */
   dlSetAlloc( ALLOC_SCENEOBJECT );
   tmp = dlCalloc( object->num_childs, sizeof(dlObject*) );
   if(!tmp)
   { RET("%d", RETURN_FAIL); return( RETURN_FAIL ); }

   /* add everything expect the one we are looking for to tmp list */
   i = 0;
   found = 0;
   for(; i != object->num_childs; ++i)
   {
      if( object->child[i] != child )
      {
         tmp[++found] = object->child[i];
      }
   }

   if(found)
   {
      /* resize list */
      tmp2 = dlRealloc( tmp, object->num_childs, found, sizeof(dlObject*) );
      if(!tmp2)
      {
         dlFree( tmp, object->num_childs * sizeof(dlObject*) );
         tmp = NULL;

         RET("%d", RETURN_FAIL); return( RETURN_FAIL );
      }
   }
   else
   {
      dlFree( tmp, object->num_childs * sizeof(dlObject*) );
      tmp = NULL;
   }

   /* ok, free the old list */
   dlFree( object->child, object->num_childs * sizeof(dlObject*) );
   dlFreeObject( child );

   /* use the new list and new count */
   object->child        = tmp;
   object->num_childs   = found;

   RET("%d", RETURN_OK);
   return( RETURN_OK );
}