Diff for /libelwix/src/array.c between versions 1.3 and 1.7.2.1

version 1.3, 2013/09/02 11:13:28 version 1.7.2.1, 2019/01/22 16:16:45
Line 12  terms: Line 12  terms:
 All of the documentation and software included in the ELWIX and AITNET  All of the documentation and software included in the ELWIX and AITNET
 Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>  Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org>
   
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013Copyright 2004 - 2019
         by Michael Pounov <misho@elwix.org>.  All rights reserved.          by Michael Pounov <misho@elwix.org>.  All rights reserved.
   
 Redistribution and use in source and binary forms, with or without  Redistribution and use in source and binary forms, with or without
Line 74  array_Init(int numItems) Line 74  array_Init(int numItems)
 }  }
   
 /*  /*
    * array_Init2() - Initialize dynamic array
    *
    * @arr = Allocated array variable
    * @numItems = Number of Items
    * return: NULL error, != NULL allocated memory for array
    */
   array_t *
   array_Init2(array_t * __restrict arr, int numItems)
   {
           if (!arr)
                   return array_Init(numItems);
   
           if (array_Size(arr))
                   return NULL;    /* already allocated array! */
   
           arr->arr_last = -1;
           arr->arr_num = numItems;
           arr->arr_data = e_calloc(array_Size(arr), sizeof(intptr_t));
           if (!arr->arr_data) {
                   e_free(arr);
                   return NULL;
           } else
                   array_Zero(arr);
   
           return arr;
   }
   
   
   /*
  * array_From() - Create and fill array from array with pointers   * array_From() - Create and fill array from array with pointers
  *   *
  * @pargv = Array with pointers   * @pargv = Array with pointers
Line 170  array_Destroy(array_t ** __restrict parr) Line 199  array_Destroy(array_t ** __restrict parr)
                 e_free((*parr)->arr_data);                  e_free((*parr)->arr_data);
         e_free(*parr);          e_free(*parr);
         *parr = NULL;          *parr = NULL;
   }
   
   /*
    * array_Reset() - Reset array to initial state
    *
    * @parr = Array
    * @purge = Purge data, if <>0 then will be free entire data memory
    * return: none
    */
   void
   array_Reset(array_t * __restrict arr, int purge)
   {
           if (!arr)
                   return;
   
           if (purge && arr->arr_data) {
                   e_free(arr->arr_data);
                   arr->arr_num = 0;
                   arr->arr_data = e_calloc(array_Size(arr), sizeof(intptr_t));
           }
   
           array_Zero(arr);
           arr->arr_last = -1;
 }  }
   
 /*  /*

Removed from v.1.3  
changed lines
  Added in v.1.7.2.1


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>