Diff for /libelwix/inc/elwix/avar.h between versions 1.1 and 1.3

version 1.1, 2013/01/17 10:05:35 version 1.3, 2013/07/09 00:18:19
Line 285  typedef struct { Line 285  typedef struct {
                                                                         AIT_LEN((_v))); \                                                                          AIT_LEN((_v))); \
                                         } while (0)                                          } while (0)
   
   #define AIT_VAL_INITIALIZER(_vl)        { .val_type = empty, .val_opt = 0, \
                                                   .val_key = 0, .val_len = 0, \
                                                   .val.net = 0LL \
                                           }
 #define AIT_INIT_VAL(_vl)               (memset((_vl), 0, sizeof(ait_val_t)))  #define AIT_INIT_VAL(_vl)               (memset((_vl), 0, sizeof(ait_val_t)))
 #define AIT_INIT_VAL2(_vl, _t)          do { \  #define AIT_INIT_VAL2(_vl, _t)          do { \
                                                 AIT_INIT_VAL((_vl)); \                                                  AIT_INIT_VAL((_vl)); \
Line 340  typedef struct { Line 344  typedef struct {
  * @vars = Variable array   * @vars = Variable array
  * return: -1 error, 0 nothing done or >0 size of marshaled data   * return: -1 error, 0 nothing done or >0 size of marshaled data
  */   */
inline int ait_vars2buffer(unsigned char * __restrict buf, int buflen, int ait_vars2buffer(unsigned char * __restrict buf, int buflen, 
                 array_t * __restrict vars);                  array_t * __restrict vars);
 /*  /*
  * ait_buffer2vars() - De-marshaling data from buffer to array with variables   * ait_buffer2vars() - De-marshaling data from buffer to array with variables
Line 352  inline int ait_vars2buffer(unsigned char * __restrict  Line 356  inline int ait_vars2buffer(unsigned char * __restrict 
                 *DON'T MODIFY OR DESTROY BUFFER*. =0 call array_Free() before array_Destroy()                  *DON'T MODIFY OR DESTROY BUFFER*. =0 call array_Free() before array_Destroy()
  * return: =NULL error, !=NULL allocated variable array, after use must free with array_Destroy()   * return: =NULL error, !=NULL allocated variable array, after use must free with array_Destroy()
  */   */
inline array_t *ait_buffer2vars(unsigned char * __restrict buf, int buflen, int vnum, int zcpy);array_t *ait_buffer2vars(unsigned char * __restrict buf, int buflen, int vnum, int zcpy);
 /*  /*
  * ait_vars2map() - Marshaling data from array with variables to memory map   * ait_vars2map() - Marshaling data from array with variables to memory map
  *   *
Line 361  inline array_t *ait_buffer2vars(unsigned char * __rest Line 365  inline array_t *ait_buffer2vars(unsigned char * __rest
  * @vars = Variable array   * @vars = Variable array
  * return: -1 error, 0 nothing done or >0 size of marshaled data   * return: -1 error, 0 nothing done or >0 size of marshaled data
  */   */
inline int ait_vars2map(unsigned char * __restrict buf, int buflen, array_t * __restrict vars);int ait_vars2map(unsigned char * __restrict buf, int buflen, array_t * __restrict vars);
 /*  /*
  * ait_map2vars() - De-marshaling data from memory map to array with variables   * ait_map2vars() - De-marshaling data from memory map to array with variables
  *   *
Line 372  inline int ait_vars2map(unsigned char * __restrict buf Line 376  inline int ait_vars2map(unsigned char * __restrict buf
                 *DON'T MODIFY OR DESTROY BUFFER*. =0 call array_Free() before array_Destroy()                  *DON'T MODIFY OR DESTROY BUFFER*. =0 call array_Free() before array_Destroy()
  * return: =NULL error, !=NULL allocated variable array, after use must free with array_Destroy()   * return: =NULL error, !=NULL allocated variable array, after use must free with array_Destroy()
  */   */
inline array_t *ait_map2vars(unsigned char * __restrict buf, int buflen, int vnum, int zcpy);array_t *ait_map2vars(unsigned char * __restrict buf, int buflen, int vnum, int zcpy);
   
   
 /*  /*
Line 380  inline array_t *ait_map2vars(unsigned char * __restric Line 384  inline array_t *ait_map2vars(unsigned char * __restric
  *   *
  * return: NULL error or new variable, after use free variable with ait_freeVar()   * return: NULL error or new variable, after use free variable with ait_freeVar()
  */   */
inline ait_val_t *ait_allocVar(void);ait_val_t *ait_allocVar(void);
 /*  /*
  * ait_freeVar() - Free allocated memory for variable   * ait_freeVar() - Free allocated memory for variable
  *   *
  * @val = Variable   * @val = Variable
  * return: none   * return: none
  */   */
inline void ait_freeVar(ait_val_t ** __restrict val);void ait_freeVar(ait_val_t ** __restrict val);
 /*  /*
  * ait_makeVar() - Allocate memory and fill variable   * ait_makeVar() - Allocate memory and fill variable
  *   *
Line 403  ait_val_t *ait_makeVar(ait_type_t type, ...); Line 407  ait_val_t *ait_makeVar(ait_type_t type, ...);
  * @v = variable   * @v = variable
  * return: return raw data   * return: return raw data
  */   */
inline uint64_t ait_getlikeVar(ait_val_t * __restrict v);uint64_t ait_getlikeVar(ait_val_t * __restrict v);
 /*  /*
  * ait_setlikeVar() - Set variable like ...   * ait_setlikeVar() - Set variable like ...
  *   *
Line 413  inline uint64_t ait_getlikeVar(ait_val_t * __restrict  Line 417  inline uint64_t ait_getlikeVar(ait_val_t * __restrict 
  * @... = data   * @... = data
  * return: -1 error or 0 ok   * return: -1 error or 0 ok
  */   */
inline int ait_setlikeVar(ait_val_t * __restrict v, ait_type_t t, unsigned int l, ...);int ait_setlikeVar(ait_val_t * __restrict v, ait_type_t t, unsigned int l, ...);
 /*  /*
  * ait_sprintfVar() - Builtin string variable from formatted input   * ait_sprintfVar() - Builtin string variable from formatted input
  *   *
Line 430  int ait_sprintfVar(ait_val_t * __restrict v, const cha Line 434  int ait_sprintfVar(ait_val_t * __restrict v, const cha
  * @b = 2nd variable   * @b = 2nd variable
  * return: 0 is equal or !=0 is different   * return: 0 is equal or !=0 is different
  */   */
inline int ait_cmpVar(ait_val_t * __restrict a, ait_val_t * __restrict b);int ait_cmpVar(ait_val_t * __restrict a, ait_val_t * __restrict b);
 /*  /*
  * ait_hashVar() - Generate hash key for variable from string or value   * ait_hashVar() - Generate hash key for variable from string or value
  *   *
Line 447  unsigned short ait_hashVar(ait_val_t * __restrict v, c Line 451  unsigned short ait_hashVar(ait_val_t * __restrict v, c
  * @varnum = Number of variables   * @varnum = Number of variables
  * return: =NULL error or !=NULL allocated array   * return: =NULL error or !=NULL allocated array
  */   */
inline array_t *ait_allocVars(int varnum);array_t *ait_allocVars(int varnum);
 /*  /*
  * ait_clrVars() - Clear ait_val_t elements from array   * ait_clrVars() - Clear ait_val_t elements from array
  *   *
  * @vars = Variable array   * @vars = Variable array
  * return: -1 error or size of array   * return: -1 error or size of array
  */   */
inline int ait_clrVars(array_t * __restrict vars);int ait_clrVars(array_t * __restrict vars);
 /*  /*
  * ait_freeVars() - Free ait_val_t array   * ait_freeVars() - Free ait_val_t array
  *   *
  * @vars = Variable array   * @vars = Variable array
  * return: none   * return: none
  */   */
inline void ait_freeVars(array_t ** __restrict vars);void ait_freeVars(array_t ** __restrict vars);
 /*  /*
  * ait_getVars() - Get ait_val_t element from array and if not exists allocate it   * ait_getVars() - Get ait_val_t element from array and if not exists allocate it
  *   *
Line 469  inline void ait_freeVars(array_t ** __restrict vars); Line 473  inline void ait_freeVars(array_t ** __restrict vars);
  * @n = index of variable into array   * @n = index of variable into array
  * return: NULL error or !=NULL ait_val_t element   * return: NULL error or !=NULL ait_val_t element
  */   */
inline ait_val_t *ait_getVars(array_t ** __restrict vars, int n);ait_val_t *ait_getVars(array_t ** __restrict vars, int n);
 /*  /*
  * ait_sortVarsByKey() - Sorting array with variables by key   * ait_sortVarsByKey() - Sorting array with variables by key
  *   *
Line 477  inline ait_val_t *ait_getVars(array_t ** __restrict va Line 481  inline ait_val_t *ait_getVars(array_t ** __restrict va
  * @order = Sort order. If =0 ascend or !=0 descend   * @order = Sort order. If =0 ascend or !=0 descend
  * return: none   * return: none
  */   */
inline void ait_sortVarsByKey(array_t * __restrict vars, int order);void ait_sortVarsByKey(array_t * __restrict vars, int order);
 /*  /*
  * ait_sortVarsByVal() - Sorting array with variables by value   * ait_sortVarsByVal() - Sorting array with variables by value
  *   *
Line 486  inline void ait_sortVarsByKey(array_t * __restrict var Line 490  inline void ait_sortVarsByKey(array_t * __restrict var
  * @cmp = Custom compare function for sorting. If =NULL compare by value   * @cmp = Custom compare function for sorting. If =NULL compare by value
  * return: none   * return: none
  */   */
inline void ait_sortVarsByVal(array_t * __restrict vars, int order,  void ait_sortVarsByVal(array_t * __restrict vars, int order,  
                 int (*cmp)(const void*, const void*));                  int (*cmp)(const void*, const void*));
 /*  /*
  * ait_findKeyVars() - Find variable by key from array   * ait_findKeyVars() - Find variable by key from array
Line 503  ait_val_t *ait_findKeyVars(array_t * __restrict vars,  Line 507  ait_val_t *ait_findKeyVars(array_t * __restrict vars, 
  * @key = Search string   * @key = Search string
  * return: NULL error or not found, !=NULL valid element   * return: NULL error or not found, !=NULL valid element
  */   */
inline ait_val_t *ait_findKeyHash(array_t * __restrict vars, const char * __restrict key);ait_val_t *ait_findKeyHash(array_t * __restrict vars, const char * __restrict key);
 /*  /*
  * ait_hashKeyVars() - Generate hash keys for variables   * ait_hashKeyVars() - Generate hash keys for variables
  *   *
  * @vars = Variables   * @vars = Variables
  * return -1 error or 0 ok   * return -1 error or 0 ok
  */   */
inline int ait_hashKeyVars(array_t * __restrict vars);int ait_hashKeyVars(array_t * __restrict vars);
   
   
 #endif  #endif

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


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