Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Allow to use xbt_dynar_shrink() to expend the dynar instead
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 9 Apr 2010 10:18:35 +0000 (10:18 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 9 Apr 2010 10:18:35 +0000 (10:18 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7504 48e7efb5-ca39-0410-a469-dd3cf9ba447f

ChangeLog
src/xbt/dynar.c

index 086d227..4b03ca4 100644 (file)
--- 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
index dd449b8..539517f 100644 (file)
@@ -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);
   }