Changeset f9cb4df in tol


Ignore:
Timestamp:
Aug 15, 2010, 10:13:52 PM (16 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
94aae25
Parents:
e3ade54
Message:

Avoiding invalid access to non initialized hashes

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@2471 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/btol/vmatrix_type/vmat_subtypes.cpp

    re3ade54 rf9cb4df  
    4141// Static functions
    4242////////////////////////////////////////////////////////////////////////////////
     43static BHashCodeName* hashCodeName_ = NULL;
     44static BHashCSysName* hashCSysName_ = NULL;
     45static BHashCFacName* hashCFacName_ = NULL;
     46static BHashDefCode*  hashDefCode_  = NULL;
     47static BHashConvert*  hashConvert_  = NULL;
     48static BHashProduct*  hashProduct_  = NULL;
     49static BHashCholSol*  hashCholSol_  = NULL;
     50static BHashCholFac*  hashCholFac_  = NULL;
     51
     52static bool InitialiceHashes()
     53{
     54  static bool done_ = false;
     55  if(!done_)
     56  {
     57    done_ = true;
     58    hashCodeName_ = new BHashCodeName;
     59    hashCSysName_ = new BHashCSysName;
     60    hashCFacName_ = new BHashCFacName;
     61    hashDefCode_  = new BHashDefCode;
     62    hashConvert_  = new BHashConvert;
     63    hashProduct_  = new BHashProduct;
     64    hashCholSol_  = new BHashCholSol;
     65    hashCholFac_  = new BHashCholFac;
     66  }
     67  return(done_);
     68}
     69
    4370BHashCodeName& HashCodeName()
    44 { static BHashCodeName hashCodeName_; return(hashCodeName_); }
     71{ InitialiceHashes();  return(*hashCodeName_); }
    4572BHashCSysName& HashCSysName()
    46 { static BHashCSysName hashCSysName_; return(hashCSysName_); }
     73{ InitialiceHashes(); return(*hashCSysName_); }
    4774BHashCFacName& HashCFacName()
    48 { static BHashCFacName hashCFacName_; return(hashCFacName_); }
     75{ InitialiceHashes(); return(*hashCFacName_); }
    4976BHashDefCode&  HashDefCode()
    50 { static BHashDefCode  hashDefCode_;  return(hashDefCode_ ); }
     77{ InitialiceHashes(); return(*hashDefCode_ ); }
    5178BHashConvert&  HashConvert() 
    52 { static BHashConvert  hashConvert_;  return(hashConvert_ ); }
     79{ InitialiceHashes(); return(*hashConvert_ ); }
    5380BHashProduct&  HashProduct()
    54 { static BHashProduct  hashProduct_;  return(hashProduct_ ); }
     81{ InitialiceHashes(); return(*hashProduct_ ); }
    5582BHashCholSol&  HashCholSol()
    56 { static BHashCholSol  hashCholSol_;  return(hashCholSol_ ); }
     83{ InitialiceHashes(); return(*hashCholSol_ ); }
    5784BHashCholFac&  HashCholFac()
    58 { static BHashCholFac  hashCholFac_;  return(hashCholFac_ ); }
     85{ InitialiceHashes(); return(*hashCholFac_ ); }
    5986
    6087////////////////////////////////////////////////////////////////////////////////
    … …  
    150177  if(!done_)
    151178  {
     179
    152180    int i;
    153181    done_ = true;
     182
    154183/*
    155184#define CHOLMOD_OK            ( 0) // success
Note: See TracChangeset for help on using the changeset viewer.