A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git]
/
src
/
include
/
surf
/
surf_resource.h
diff --git
a/src/include/surf/surf_resource.h
b/src/include/surf/surf_resource.h
index
78afcd7
..
963fdff
100644
(file)
--- 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
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
@@
-10,30
+10,36
@@
#define SURF_RESOURCE_H
static XBT_INLINE
#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, void_f_pvoid_t free_f)
+{
surf_resource_t res = xbt_malloc0(childsize);
res->model = model;
surf_resource_t res = xbt_malloc0(childsize);
res->model = model;
- res->name =
name
;
+ res->name =
xbt_strdup(name)
;
res->properties = props;
res->properties = props;
+ res->free_f=free_f;
return res;
}
return res;
}
-static XBT_INLINE void surf_resource_free(void* r) {
+static XBT_INLINE void surf_resource_free(void *r)
+{
surf_resource_t resource = r;
surf_resource_t resource = r;
- if
(resource->name
)
-
free(resource->name
);
- if (resource->properties)
-
xbt_dict_free(&resource->properties);
+ if
(resource->free_f
)
+
resource->free_f(r
);
+ free(resource->name);
+ xbt_dict_free(&resource->properties);
free(resource);
}
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 */