From c8609cfa97f9f2663b6a93ec84da8641b3ce657b Mon Sep 17 00:00:00 2001 From: mquinson Date: Fri, 9 Apr 2010 10:18:35 +0000 Subject: [PATCH] Allow to use xbt_dynar_shrink() to expend the dynar instead git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7504 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- ChangeLog | 1 + src/xbt/dynar.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 086d22723e..4b03ca4ab0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -62,6 +62,7 @@ SimGrid (3.3.5-svn) unstable; urgency=low In contrary to regular dicts, the key is not malloced before copy. Mixing scalar and regular elements in the same dict is not tested (but may work). + * Allow to use xbt_dynar_shrink() to expend the dynar instead Tracing for Visualization: * SimGrid is now instrumented in order to generate a trace file for visualization analysis: to use it, need to compile SimGrid with the diff --git a/src/xbt/dynar.c b/src/xbt/dynar.c index dd449b8d45..539517f32b 100644 --- a/src/xbt/dynar.c +++ b/src/xbt/dynar.c @@ -290,7 +290,7 @@ XBT_INLINE void xbt_dynar_reset(xbt_dynar_t const dynar) * Set \a empty_slots_wanted to zero to reduce the dynar internal array as much * as possible. * Note that if \a empty_slots_wanted is greater than the array size, the internal - * array is not expanded and nothing is done. + * array is expanded instead of shriked. */ void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted) { @@ -299,7 +299,7 @@ void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted) _dynar_lock(dynar); size_wanted = dynar->used + empty_slots_wanted; - if (size_wanted < dynar->size) { + if (size_wanted != dynar->size) { dynar->size = size_wanted; dynar->data = xbt_realloc(dynar->data, sizeof(void *) * dynar->size); } -- 2.20.1