Diff for /parser3/src/include/pa_array.h between versions 1.71 and 1.78

version 1.71, 2009/04/17 09:55:21 version 1.78, 2009/04/30 04:40:30
Line 80  public: Line 80  public:
                 fallocated(initial),                  fallocated(initial),
                 fused(0)                  fused(0)
         {          {
                 felements=fallocated?static_cast<T*>(malloc(fallocated*sizeof(T))):0;                  felements=fallocated?(T *)pa_malloc(fallocated*sizeof(T)):0;
         }          }
   
   #ifdef USE_DESTRUCTORS 
           inline ~Array(){
                   if(felements)
                           pa_free(felements);
           }
   #endif
   
         /// how many items are in Array          /// how many items are in Array
         inline size_t count() const { return fused; }          inline size_t count() const { return fused; }
         /// append to array          /// append to array
Line 188  public: Line 195  public:
                 return T(0);                  return T(0);
         }          }
   
           inline T* ptr(size_t index){
                   return felements + index;
           }
   
 protected:  protected:
   
         bool is_full() {          bool is_full() {
Line 196  protected: Line 207  protected:
         void expand(size_t delta) {          void expand(size_t delta) {
                 if(fallocated){                  if(fallocated){
                         size_t new_allocated=fallocated+delta;                          size_t new_allocated=fallocated+delta;
                         felements = (T *)realloc(felements, new_allocated*sizeof(T));                          felements=(T *)pa_realloc(felements, new_allocated*sizeof(T));
                         memset(&felements[fallocated], 0, delta*sizeof(T));  
                         fallocated=new_allocated;                          fallocated=new_allocated;
                 } else {                  } else {
                         fallocated=delta;                          fallocated=delta;
                         felements=static_cast<T*>(malloc(fallocated*sizeof(T)));                          felements=(T *)pa_malloc(fallocated*sizeof(T));
                 }                  }
         }          }
   

Removed from v.1.71  
changed lines
  Added in v.1.78


E-mail: