Diff for /rpl/src/instructions_v1.c between versions 1.50 and 1.51

version 1.50, 2013/03/21 11:30:30 version 1.51, 2013/03/23 16:14:39
Line 1023  instruction_vars(struct_processus *s_eta Line 1023  instruction_vars(struct_processus *s_eta
     (*s_objet_resultat).objet = NULL;      (*s_objet_resultat).objet = NULL;
     l_element_precedent = NULL;      l_element_precedent = NULL;
   
       if (pthread_mutex_lock(&mutex_liste_variables_partagees) != 0)
       {
           (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
           return;
       }
   
     nb_variables = nombre_variables(s_etat_processus);      nb_variables = nombre_variables(s_etat_processus);
   
     if ((tableau = malloc(((size_t) nb_variables) *      if ((tableau = malloc(((size_t) nb_variables) *
Line 1030  instruction_vars(struct_processus *s_eta Line 1036  instruction_vars(struct_processus *s_eta
     {      {
         liberation_mutexes_arbre_variables_partagees(s_etat_processus,          liberation_mutexes_arbre_variables_partagees(s_etat_processus,
                 (*(*s_etat_processus).s_arbre_variables_partagees));                  (*(*s_etat_processus).s_arbre_variables_partagees));
           pthread_mutex_unlock(&mutex_liste_variables_partagees);
         (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;          (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
         return;          return;
     }      }
   
     liste_variables(s_etat_processus, tableau);      nb_variables = liste_variables(s_etat_processus, tableau);
   
       if (pthread_mutex_unlock(&mutex_liste_variables_partagees) != 0)
       {
           (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
           return;
       }
   
     for(i = 0; i < nb_variables; i++)      for(i = 0; i < nb_variables; i++)
     {      {
Line 1093  instruction_vars(struct_processus *s_eta Line 1106  instruction_vars(struct_processus *s_eta
                     tableau[i].origine) == NULL)                      tableau[i].origine) == NULL)
             {              {
                 // La variable partagée n'existe plus.                  // La variable partagée n'existe plus.
   
                 continue;                  continue;
             }              }
   
Line 1122  instruction_vars(struct_processus *s_eta Line 1134  instruction_vars(struct_processus *s_eta
                 }                  }
             }              }
   
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1145  instruction_vars(struct_processus *s_eta Line 1163  instruction_vars(struct_processus *s_eta
                 }                  }
             }              }
   
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1171  instruction_vars(struct_processus *s_eta Line 1195  instruction_vars(struct_processus *s_eta
                 }                  }
             }              }
   
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1189  instruction_vars(struct_processus *s_eta Line 1219  instruction_vars(struct_processus *s_eta
                 }                  }
             }              }
   
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1215  instruction_vars(struct_processus *s_eta Line 1251  instruction_vars(struct_processus *s_eta
                 }                  }
             }              }
   
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1236  instruction_vars(struct_processus *s_eta Line 1278  instruction_vars(struct_processus *s_eta
                     return;                      return;
                 }                  }
   
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1243  instruction_vars(struct_processus *s_eta Line 1292  instruction_vars(struct_processus *s_eta
             if (pthread_mutex_unlock(&((*(*s_etat_processus)              if (pthread_mutex_unlock(&((*(*s_etat_processus)
                     .pointeur_variable_partagee_courante).mutex)) != 0)                      .pointeur_variable_partagee_courante).mutex)) != 0)
             {              {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_processus;                  (*s_etat_processus).erreur_systeme = d_es_processus;
                 return;                  return;
             }              }
Line 1256  instruction_vars(struct_processus *s_eta Line 1312  instruction_vars(struct_processus *s_eta
                     .donnee = copie_objet(s_etat_processus, tableau[i].objet,                      .donnee = copie_objet(s_etat_processus, tableau[i].objet,
                     'P')) == NULL)                      'P')) == NULL)
             {              {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1269  instruction_vars(struct_processus *s_eta Line 1332  instruction_vars(struct_processus *s_eta
                 (*l_element_courant).donnee)).objet)).suivant).suivant)                  (*l_element_courant).donnee)).objet)).suivant).suivant)
                 .suivant = allocation_maillon(s_etat_processus)) == NULL)                  .suivant = allocation_maillon(s_etat_processus)) == NULL)
         {          {
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1277  instruction_vars(struct_processus *s_eta Line 1346  instruction_vars(struct_processus *s_eta
                 (*l_element_courant).donnee)).objet)).suivant).suivant).suivant)                  (*l_element_courant).donnee)).objet)).suivant).suivant).suivant)
                 .donnee = allocation(s_etat_processus, CHN)) == NULL)                  .donnee = allocation(s_etat_processus, CHN)) == NULL)
         {          {
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1290  instruction_vars(struct_processus *s_eta Line 1365  instruction_vars(struct_processus *s_eta
                     .suivant).donnee).objet = malloc(7 *                      .suivant).donnee).objet = malloc(7 *
                     sizeof(unsigned char))) == NULL)                      sizeof(unsigned char))) == NULL)
             {              {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1315  instruction_vars(struct_processus *s_eta Line 1397  instruction_vars(struct_processus *s_eta
                     (*l_element_courant).donnee)).objet)).suivant).suivant)                      (*l_element_courant).donnee)).objet)).suivant).suivant)
                     .suivant).donnee).objet = malloc(9 *                      .suivant).donnee).objet = malloc(9 *
                     sizeof(unsigned char))) == NULL)                      sizeof(unsigned char))) == NULL)
             {              { 
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1334  instruction_vars(struct_processus *s_eta Line 1423  instruction_vars(struct_processus *s_eta
                 .suivant).suivant = allocation_maillon(s_etat_processus))                  .suivant).suivant = allocation_maillon(s_etat_processus))
                 == NULL)                  == NULL)
         {          {
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1343  instruction_vars(struct_processus *s_eta Line 1438  instruction_vars(struct_processus *s_eta
                 .suivant).donnee = allocation(s_etat_processus, CHN))                  .suivant).donnee = allocation(s_etat_processus, CHN))
                 == NULL)                  == NULL)
         {          {
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1354  instruction_vars(struct_processus *s_eta Line 1455  instruction_vars(struct_processus *s_eta
                     .suivant).suivant).donnee).objet = malloc(7 *                      .suivant).suivant).donnee).objet = malloc(7 *
                     sizeof(unsigned char))) == NULL)                      sizeof(unsigned char))) == NULL)
             {              {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1370  instruction_vars(struct_processus *s_eta Line 1478  instruction_vars(struct_processus *s_eta
                     .suivant).suivant).donnee).objet = malloc(9 *                      .suivant).suivant).donnee).objet = malloc(9 *
                     sizeof(unsigned char))) == NULL)                      sizeof(unsigned char))) == NULL)
             {              {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1389  instruction_vars(struct_processus *s_eta Line 1504  instruction_vars(struct_processus *s_eta
                 .suivant).suivant).suivant =                  .suivant).suivant).suivant =
                 allocation_maillon(s_etat_processus)) == NULL)                  allocation_maillon(s_etat_processus)) == NULL)
         {          {
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1398  instruction_vars(struct_processus *s_eta Line 1519  instruction_vars(struct_processus *s_eta
                 .suivant).suivant).donnee = allocation(s_etat_processus,                  .suivant).suivant).donnee = allocation(s_etat_processus,
                 CHN)) == NULL)                  CHN)) == NULL)
         {          {
               if (tableau[i].mutex != NULL)
               {
                   // La variable est une variable partagée. On libère le mutex.
                   pthread_mutex_unlock(tableau[i].mutex);
               }
   
             (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;              (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
             return;              return;
         }          }
Line 1409  instruction_vars(struct_processus *s_eta Line 1536  instruction_vars(struct_processus *s_eta
                     .suivant).suivant).suivant).donnee).objet = malloc(7 *                      .suivant).suivant).suivant).donnee).objet = malloc(7 *
                     sizeof(unsigned char))) == NULL)                      sizeof(unsigned char))) == NULL)
             {              {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1425  instruction_vars(struct_processus *s_eta Line 1559  instruction_vars(struct_processus *s_eta
                     .suivant).suivant).suivant).donnee).objet = malloc(8 *                      .suivant).suivant).suivant).donnee).objet = malloc(8 *
                     sizeof(unsigned char))) == NULL)                      sizeof(unsigned char))) == NULL)
             {              {
                   if (tableau[i].mutex != NULL)
                   {
                       // La variable est une variable partagée. On libère
                       // le mutex.
                       pthread_mutex_unlock(tableau[i].mutex);
                   }
   
                 (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;                  (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                 return;                  return;
             }              }
Line 1444  instruction_vars(struct_processus *s_eta Line 1585  instruction_vars(struct_processus *s_eta
                 .suivant).suivant).suivant).suivant = NULL;                  .suivant).suivant).suivant).suivant = NULL;
   
         l_element_precedent = l_element_courant;          l_element_precedent = l_element_courant;
   
           if (tableau[i].mutex != NULL)
           {
               // La variable est une variable partagée. On libère
               // le mutex.
               pthread_mutex_unlock(tableau[i].mutex);
           }
     }      }
   
     free(tableau);      free(tableau);

Removed from v.1.50  
changed lines
  Added in v.1.51


CVSweb interface <joel.bertrand@systella.fr>