Diff for /libelwix/inc/elwix/aarray.h between versions 1.3 and 1.10

version 1.3, 2013/06/19 00:11:16 version 1.10, 2019/01/23 18:22:41
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 55  typedef struct _tagArray { Line 55  typedef struct _tagArray {
   
 #define array_Size(_arr)                ((_arr) ? (_arr)->arr_num : 0)  #define array_Size(_arr)                ((_arr) ? (_arr)->arr_num : 0)
 #define array_Last(_arr)                (array_Size((_arr)) ? (_arr)->arr_last : -1)  #define array_Last(_arr)                (array_Size((_arr)) ? (_arr)->arr_last : -1)
#define array_Zero(_arr)                (assert((_arr)), memset((_arr)->arr_data, 0, \#define array_Zero(_arr)                (assert((_arr)), (_arr)->arr_last = -1, \
                                                array_Size((_arr)) * sizeof(intptr_t)))                                                memset((_arr)->arr_data, 0, array_Size((_arr)) * sizeof(intptr_t)))
   
 #define array_Ptr(_arr, _d)             ((_arr) ? (_arr)->arr_data[_d] : NULL)  #define array_Ptr(_arr, _d)             ((_arr) ? (_arr)->arr_data[_d] : NULL)
 #define array_Get2(_arr, _d)            (assert((_arr) && (_arr)->arr_num > _d), ((_arr)->arr_data + _d))  #define array_Get2(_arr, _d)            (assert((_arr) && (_arr)->arr_num > _d), ((_arr)->arr_data + _d))
#define array_Get(_arr, _d)             (assert((_arr) && (_arr)->arr_num > _d), (_arr)->arr_data[_d])#define array_Get(_arr, _d)             (assert((_arr)), (_arr)->arr_data[_d])
#define array(_arr, _d, _type)          (assert((_arr) && (_arr)->arr_num > _d), \#define array(_arr, _d, _type)          (assert((_arr)), ((_type) (_arr)->arr_data[_d]))
                                                ((_type) (_arr)->arr_data[_d]))#define array_Set(_arr, _d, _ptr)       do { int __d = _d; assert((_arr) && (_arr)->arr_num > __d); \
#define array_Set(_arr, _d, _ptr)       do { assert((_arr) && (_arr)->arr_num > _d); \                                                if ((_arr)->arr_last < __d) \
                                                if ((_arr)->arr_last < _d) \                                                        (_arr)->arr_last = __d; \
                                                        (_arr)->arr_last = _d; \                                                (_arr)->arr_data[__d] = (void*) (_ptr); \
                                                (_arr)->arr_data[_d] = (void*) (_ptr); \ 
                                         } while (0)                                          } while (0)
#define array_Del(_arr, _d, _fri)       do { assert((_arr) && (_arr)->arr_num > _d); \#define array_Del(_arr, _d, _fri)       do { int __d = _d; assert((_arr) && (_arr)->arr_num > __d); \
                                                if (_fri && (_arr)->arr_data[_d]) \                                                if (_fri && (_arr)->arr_data[__d]) \
                                                        e_free((_arr)->arr_data[_d]); \                                                        e_free((_arr)->arr_data[__d]); \
                                                (_arr)->arr_data[_d] = NULL; \                                                (_arr)->arr_data[__d] = NULL; \
                                         } while (0)                                          } while (0)
   
 /*  /*
Line 82  typedef struct _tagArray { Line 81  typedef struct _tagArray {
  */   */
 array_t *array_Init(int numItems);  array_t *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);
   /*
  * array_Destroy() - Free and destroy dynamic array   * array_Destroy() - Free and destroy dynamic array
  *   *
  * @parr = Array   * @parr = Array
Line 89  array_t *array_Init(int numItems); Line 96  array_t *array_Init(int numItems);
  */   */
 void array_Destroy(array_t ** __restrict parr);  void array_Destroy(array_t ** __restrict parr);
 /*  /*
    * array_Destroy2() - Free data in dynamic array
    *
    * @parr = Array
    * return: none
    */
   void array_Destroy2(array_t * __restrict arr);
   /*
  * array_Free() - Free all data in dynamic array items   * array_Free() - Free all data in dynamic array items
  *      (WARNING! If assign static array dont use this!!!)   *      (WARNING! If assign static array dont use this!!!)
  *   *
Line 96  void array_Destroy(array_t ** __restrict parr); Line 110  void array_Destroy(array_t ** __restrict parr);
  * return: none   * return: none
  */   */
 void array_Free(array_t * __restrict arr);  void array_Free(array_t * __restrict arr);
   /*
    * array_Reset() - Reset array to initial state
    *
    * @parr = Array
    * @purge = Purge all data, if <>0 then will be free entire data memory
    * return: none
    */
   void array_Reset(array_t * __restrict arr, int purge);
   
 /*  /*
  * array_From() - Create and fill array from array with pointers   * array_From() - Create and fill array from array with pointers
Line 107  void array_Free(array_t * __restrict arr); Line 129  void array_Free(array_t * __restrict arr);
 array_t *array_From(const char *** __restrict pargv, int argc);  array_t *array_From(const char *** __restrict pargv, int argc);
 /*  /*
  * array_Args() Parse and make array from arguments ... (input string will be modified!!!    * array_Args() Parse and make array from arguments ... (input string will be modified!!! 
 *      and output array must be free with io_arrayDestroy() after use!) *      and output array must be free with array_Destroy() after use!)
  *   *
  * @psArgs = Input arguments line, after execute string is modified!!!   * @psArgs = Input arguments line, after execute string is modified!!!
  * @nargs = Maximum requested count of arguments from input string psArgs, if 0 all psArgs   * @nargs = Maximum requested count of arguments from input string psArgs, if 0 all psArgs
Line 161  int array_Concat(array_t * __restrict dest, array_t *  Line 183  int array_Concat(array_t * __restrict dest, array_t * 
 /*  /*
  * array_Copy() Copy source array to destination array   * array_Copy() Copy source array to destination array
  *   *
 * @dest = Destination array, after use free with io_arrayDestroy() * @dest = Destination array, after use free with array_Destroy()
  * @src = Source array   * @src = Source array
  * return: -1 error; >0 count of destination array   * return: -1 error; >0 count of destination array
  */   */

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


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