1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
struct char_fbtAllocator *pAllocCaracs1=NULL, *pAllocCaracs2=NULL;
struct int_fbtAllocator *pAllocLignes1=NULL, *pAllocLignes2=NULL;
size_t *pTailles1=NULL, *pTailles2=NULL, nbMots1=0, nbMots2=0;
int retour = EXIT_FAILURE;
// putchar('\n');
/*Initialisation des allocateurs */
{
size_t nbCaracs1=0, nbLignes1=0, nbCaracs2=0, nbLignes2=0;
if(CompterToutesTablesFichBinaire1fr(&pTailles1, &nbCaracs1, &nbLignes1)<0)
goto LNettoyage;
if(CompterToutesTablesFichBinaire2fr(&pTailles2, &nbCaracs2, &nbLignes2)<0)
goto LNettoyage;
nbMots1 = SommeTailles1fr(pTailles1);
nbMots2 = SommeTailles2fr(pTailles2);
pAllocCaracs1 = char_CreateFbtAllocator(nbCaracs1);
pAllocCaracs2 = char_CreateFbtAllocator(nbCaracs2);
if(pAllocCaracs1==NULL || pAllocCaracs2==NULL)
goto LNettoyage;
pAllocLignes1 = int_CreateFbtAllocator(nbLignes1);
pAllocLignes2 = int_CreateFbtAllocator(nbLignes2);
if(pAllocLignes1==NULL || pAllocLignes2==NULL)
goto LNettoyage;
}
{
//creer le table et le remplit
MotCompact * pMots1fr = LireToutesTablesFichBinaire1fr(pTailles1, pAllocCaracs1, pAllocLignes1);
MotCompact * pMots2fr = LireToutesTablesFichBinaire2fr(pTailles2, pAllocCaracs2, pAllocLignes2);
if(pMots1fr==NULL || pMots2fr==NULL)
{
DetruireTableauMotsCompacts(pMots1fr), pMots1fr=NULL;
DetruireTableauMotsCompacts(pMots2fr), pMots2fr=NULL;
goto LNettoyage;
} |
Partager