Diff for /rpl/src/gestion_objets.c between versions 1.139 and 1.151

version 1.139, 2018/12/21 10:56:16 version 1.151, 2023/08/07 17:42:51
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.1.29    RPL/2 (R) version 4.1.35
   Copyright (C) 1989-2018 Dr. BERTRAND Joël    Copyright (C) 1989-2023 Dr. BERTRAND Joël
   
   This file is part of RPL/2.    This file is part of RPL/2.
   
Line 635  allocation(struct_processus *s_etat_proc Line 635  allocation(struct_processus *s_etat_proc
             }              }
             else              else
             {              {
                 if (((*s_objet).objet = malloc(2 * sizeof(struct_objet *)))                  if (((*s_objet).objet = malloc(sizeof(struct_record)))
                         == NULL)                          == NULL)
                 {                  {
                     (*s_etat_processus).erreur_systeme =                      (*s_etat_processus).erreur_systeme =
Line 1317  liberation(struct_processus *s_etat_proc Line 1317  liberation(struct_processus *s_etat_proc
             }              }
             else              else
             {              {
                 free((real8 *) ((*s_objet).objet));                  free((struct_record *) ((*s_objet).objet));
             }              }
   
             break;              break;
Line 2484  copie_objet(struct_processus *s_etat_pro Line 2484  copie_objet(struct_processus *s_etat_pro
             break;              break;
         }          }
   
           case REC :
           {
               if (type != 'P')
               {
                   if ((s_nouvel_objet = allocation(s_etat_processus, REC))
                           == NULL)
                   {
                       return(NULL);
                   }
   
                   if (((*((struct_record *) (*s_nouvel_objet).objet)).noms =
                           copie_objet(s_etat_processus, (*((struct_record *)
                           (*s_objet).objet)).noms, 'P')) == NULL)
                   {
                       return(NULL);
                   }
   
                   if (((*((struct_record *) (*s_nouvel_objet).objet)).donnees =
                           copie_objet(s_etat_processus, (*((struct_record *)
                           (*s_objet).objet)).donnees, type)) == NULL)
                   {
                       return(NULL);
                   }
               }
               else
               {
                   incrementation_atomique(s_objet);
                   (*((struct_record *) (*s_objet).objet)).noms =
                           copie_objet(s_etat_processus, (*((struct_record *)
                           (*s_objet).objet)).noms, 'P');
                   (*((struct_record *) (*s_objet).objet)).donnees =
                           copie_objet(s_etat_processus, (*((struct_record *)
                           (*s_objet).objet)).donnees, 'P');
   
                   return(s_objet);
               }
   
               break;
           }
   
         case REL :          case REL :
         {          {
             if (type != 'O')              if (type != 'O')
Line 3034  copie_etat_processus(struct_processus *s Line 3074  copie_etat_processus(struct_processus *s
         return(NULL);          return(NULL);
     }      }
   
   
       if (pthread_mutex_lock(&((*s_etat_processus).mutex_interruptions)) != 0)
       {
           (*s_etat_processus).erreur_systeme = d_es_processus;
           return(NULL);
       }
   
       if (pthread_mutex_lock(&((*s_etat_processus).mutex_signaux)) != 0)
       {
           (*s_etat_processus).erreur_systeme = d_es_processus;
           return(NULL);
       }
   
     (*s_nouvel_etat_processus) = (*s_etat_processus);      (*s_nouvel_etat_processus) = (*s_etat_processus);
   
       if (pthread_mutex_unlock(&((*s_etat_processus).mutex_signaux)) != 0)
       {
           (*s_etat_processus).erreur_systeme = d_es_processus;
           return(NULL);
       }
   
       if (pthread_mutex_unlock(&((*s_etat_processus).mutex_interruptions)) != 0)
       {
           (*s_etat_processus).erreur_systeme = d_es_processus;
           return(NULL);
       }
   
     // On réinitialise les allocateurs.      // On réinitialise les allocateurs.
   
     pthread_mutexattr_init(&attributs_mutex);      pthread_mutexattr_init(&attributs_mutex);
Line 3901  debug_memoire_ajout(size_t taille, const Line 3966  debug_memoire_ajout(size_t taille, const
             sizeof(unsigned char))) == NULL)              sizeof(unsigned char))) == NULL)
     {      {
         pthread_mutex_unlock(&mutex_allocation);          pthread_mutex_unlock(&mutex_allocation);
   
           uprintf("[%d-%llu] ILLEGAL POINTER (malloc) $%016X\n",
                   getpid(), (unsigned long long) pthread_self(), NULL);
   #       ifdef __BACKTRACE
               BACKTRACE(PROFONDEUR_PILE);
   #       endif
   
         return(NULL);          return(NULL);
     }      }
   
Line 3961  debug_memoire_modification(void *pointeu Line 4033  debug_memoire_modification(void *pointeu
             {              {
                 pthread_mutex_unlock(&mutex_allocation);                  pthread_mutex_unlock(&mutex_allocation);
   
                 uprintf("[%d-%llu] ILLEGAL POINTER (realloc)\n",                  uprintf("[%d-%llu] ILLEGAL POINTER (realloc) $%016X\n",
                         getpid(), (unsigned long long) pthread_self());                          getpid(), (unsigned long long) pthread_self(),
                           pointeur);
 #               ifdef __BACKTRACE  #               ifdef __BACKTRACE
                     BACKTRACE(PROFONDEUR_PILE);                      BACKTRACE(PROFONDEUR_PILE);
 #               endif  #               endif
Line 4058  debug_memoire_retrait(void *pointeur) Line 4131  debug_memoire_retrait(void *pointeur)
   
     if (element_courant == NULL)      if (element_courant == NULL)
     {      {
         uprintf("[%d-%llu] ILLEGAL POINTER (free)\n",          uprintf("[%d-%llu] ILLEGAL POINTER (free) $%016X\n",
                 getpid(), (unsigned long long) pthread_self());                  getpid(), (unsigned long long) pthread_self(), pointeur);
 #       ifdef __BACKTRACE  #       ifdef __BACKTRACE
             BACKTRACE(PROFONDEUR_PILE);              BACKTRACE(PROFONDEUR_PILE);
 #       endif  #       endif
Line 4176  debug_memoire_verification() Line 4249  debug_memoire_verification()
 }  }
   
 pid_t  pid_t
 debug_fork()  debug_fork(struct_processus *s_etat_processus)
 {  {
     pid_t   pid;      pid_t   pid;
   

Removed from v.1.139  
changed lines
  Added in v.1.151


CVSweb interface <joel.bertrand@systella.fr>