Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
declaration of the variables at the begining of the function
authorcherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 21 Sep 2007 15:50:56 +0000 (15:50 +0000)
committercherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 21 Sep 2007 15:50:56 +0000 (15:50 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4665 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/xbt/dynar.c

index 964f92d..8414788 100644 (file)
@@ -426,17 +426,20 @@ static XBT_INLINE void *
 _xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar,
                        const int            idx) {
    void *res;
+   unsigned long old_used;
+   unsigned long new_used;
+   unsigned long nb_shift;
    
   _sanity_check_dynar(dynar);
   _sanity_check_idx(idx);
   _check_sloppy_inbound_idx(dynar, idx);
 
-  const unsigned long old_used = dynar->used;
-  const unsigned long new_used = old_used + 1;
+  old_used = dynar->used;
+  new_used = old_used + 1;
 
   _xbt_dynar_expand(dynar, new_used);
 
-  const unsigned long nb_shift =  old_used - idx;
+  nb_shift =  old_used - idx;
 
   if (nb_shift)
      memmove(_xbt_dynar_elm(dynar, idx+1), 
@@ -520,6 +523,7 @@ xbt_dynar_search(xbt_dynar_t  const dynar,
    
   _dynar_unlock(dynar);
   THROW2(not_found_error,0,"Element %p not part of dynar %p",elem,dynar);
+  return -1;
 }
 
 /** @brief Returns a boolean indicating whether the element is part of the dynar */