X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d3b82ab21c706eff03f671a2a997c20b2e29889e..749aa9b0446802ea8db0fb604154c37993ac7cf2:/src/include/surf/surf_resource.h diff --git a/src/include/surf/surf_resource.h b/src/include/surf/surf_resource.h index 84118374ef..963fdffd89 100644 --- a/src/include/surf/surf_resource.h +++ b/src/include/surf/surf_resource.h @@ -1,5 +1,5 @@ -/* Copyright (c) 2009, 2010. The SimGrid Team. +/* Copyright (c) 2009-2013. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -12,33 +12,21 @@ static XBT_INLINE surf_resource_t surf_resource_new(size_t childsize, surf_model_t model, const char *name, - xbt_dict_t props) + xbt_dict_t props, void_f_pvoid_t free_f) { surf_resource_t res = xbt_malloc0(childsize); res->model = model; res->name = xbt_strdup(name); res->properties = props; + res->free_f=free_f; return res; } -static XBT_INLINE void routing_storage_type_free(void *r) -{ - storage_type_t stype = r; - free(stype->content); - free(stype->model); - free(stype->type_id); - xbt_dict_free(&stype->properties); - free(stype); -} - -static XBT_INLINE void routing_storage_host_free(void *r) -{ - xbt_dynar_t dyn = r; - xbt_dynar_free(&dyn); -} static XBT_INLINE void surf_resource_free(void *r) { surf_resource_t resource = r; + if(resource->free_f) + resource->free_f(r); free(resource->name); xbt_dict_free(&resource->properties); free(resource);