Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Minor optimization.
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 10 Jun 2008 14:00:34 +0000 (14:00 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 10 Jun 2008 14:00:34 +0000 (14:00 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5599 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/xbt/dict.c

index 97cfedc..3e2bd4c 100644 (file)
@@ -78,12 +78,13 @@ void xbt_dict_free(xbt_dict_t *dict) {
   if (dict != NULL && *dict != NULL) {
     table_size = (*dict)->table_size;
     table = (*dict)->table;
-    for (i = 0; i < table_size; i++) {
+    for (i = 0; (*dict)->count && i < table_size; i++) {
       current = table[i];
       while (current != NULL) {
        previous = current;
        current = current->next;
        xbt_dictelm_free(previous);
+       (*dict)->count--;
       }
     }
     xbt_free(table);