X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/01fc1d9e1180d76f5aa78180d54ef9f4088a2e90..5b3677b425b9cc6949c1573d59ac772540cbf4b2:/src/xbt/lib.c diff --git a/src/xbt/lib.c b/src/xbt/lib.c index a76ca15468..8c594cfb82 100644 --- a/src/xbt/lib.c +++ b/src/xbt/lib.c @@ -1,6 +1,6 @@ /* lib - a generic library, variation over dictionary */ -/* Copyright (c) 2011. The SimGrid Team. +/* Copyright (c) 2011, 2013-2014. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -71,7 +71,7 @@ void xbt_lib_set(xbt_lib_t lib, const char *key, int level, void *obj) } /* for vm */ -void xbt_lib_unset(xbt_lib_t lib, const char *key, int level) +void xbt_lib_unset(xbt_lib_t lib, const char *key, int level, int invoke_callback) { void **elts = xbt_dict_get_or_null(lib->dict, key); if (!elts) { @@ -83,14 +83,14 @@ void xbt_lib_unset(xbt_lib_t lib, const char *key, int level) if (!obj) { XBT_WARN("no key %s at level %d", key, level); - return; } else { XBT_DEBUG("Remove %p of key %s at level %d", obj, key, level); - lib->free_f[level](obj); + if (invoke_callback) + lib->free_f[level](obj); elts[level] = NULL; } - /* check if there are elements of this key */ + /* check if there still remains any elements of this key */ int i; for (i = 0; i < lib->levels; i++) { if (elts[i] != NULL)