Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Save information from routing corresponding to storage.
[simgrid.git] / src / include / surf / surf_resource.h
index 78afcd7..8411837 100644 (file)
 #define SURF_RESOURCE_H
 
 static XBT_INLINE
-surf_resource_t surf_resource_new(size_t childsize,
-    surf_model_t model, char *name, xbt_dict_t props) {
+    surf_resource_t surf_resource_new(size_t childsize,
+                                      surf_model_t model, const char *name,
+                                      xbt_dict_t props)
+{
   surf_resource_t res = xbt_malloc0(childsize);
   res->model = model;
-  res->name = name;
+  res->name = xbt_strdup(name);
   res->properties = props;
   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) {
+static XBT_INLINE void surf_resource_free(void *r)
+{
   surf_resource_t resource = r;
-  if (resource->name)
-    free(resource->name);
-  if (resource->properties)
-    xbt_dict_free(&resource->properties);
+  free(resource->name);
+  xbt_dict_free(&resource->properties);
   free(resource);
 }
 
-static XBT_INLINE const char *surf_resource_name(const void *resource) {
-  return ((surf_resource_t)resource)->name;
+static XBT_INLINE const char *surf_resource_name(const void *resource)
+{
+  return ((surf_resource_t) resource)->name;
 }
 
-static XBT_INLINE xbt_dict_t surf_resource_properties(const void *resource) {
-  return ((surf_resource_t)resource)->properties;
+static XBT_INLINE xbt_dict_t surf_resource_properties(const void *resource)
+{
+  return ((surf_resource_t) resource)->properties;
 }
 
-#endif /* SURF_RESOURCE_H */
+#endif                          /* SURF_RESOURCE_H */