Diff for /libaitio/src/Attic/vars.c between versions 1.3.2.1 and 1.4.4.2

version 1.3.2.1, 2011/12/13 10:40:05 version 1.4.4.2, 2012/03/27 21:37:56
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, 2011Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
         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 48  SUCH DAMAGE. Line 48  SUCH DAMAGE.
   
 /*  /*
  * io_vars2buffer() Marshaling data from array with variables to buffer   * io_vars2buffer() Marshaling data from array with variables to buffer
    *
  * @buf = Buffer   * @buf = Buffer
  * @buflen = Size of buffer   * @buflen = Size of buffer
  * @vars = Variable array   * @vars = Variable array
Line 85  io_vars2buffer(u_char *buf, int buflen, array_t *vars) Line 86  io_vars2buffer(u_char *buf, int buflen, array_t *vars)
                 val = io_array(vars, i, ait_val_t*);                  val = io_array(vars, i, ait_val_t*);
   
                 v[i].val_type = val->val_type;                  v[i].val_type = val->val_type;
                   AIT_HASH(&v[i]) = htobe16(AIT_HASH(val));
                 AIT_LEN(&v[i]) = htobe32(AIT_LEN(val));                  AIT_LEN(&v[i]) = htobe32(AIT_LEN(val));
   
                 switch (AIT_TYPE(val)) {                  switch (AIT_TYPE(val)) {
Line 127  io_vars2buffer(u_char *buf, int buflen, array_t *vars) Line 129  io_vars2buffer(u_char *buf, int buflen, array_t *vars)
   
 /*  /*
  * io_buffer2vars() De-marshaling data from buffer to array with variables   * io_buffer2vars() De-marshaling data from buffer to array with variables
    *
  * @buf = Buffer   * @buf = Buffer
  * @buflen = Size of buffer   * @buflen = Size of buffer
  * @vnum = Number of variables into buffer   * @vnum = Number of variables into buffer
Line 177  io_buffer2vars(u_char *buf, int buflen, int vnum, int  Line 180  io_buffer2vars(u_char *buf, int buflen, int vnum, int 
                 val->val_type = v[i].val_type;                  val->val_type = v[i].val_type;
 #if defined(__OpenBSD__)  #if defined(__OpenBSD__)
                 AIT_LEN(val) = betoh32(AIT_LEN(&v[i]));                  AIT_LEN(val) = betoh32(AIT_LEN(&v[i]));
                   AIT_HASH(val) = betoh16(AIT_HASH(&v[i]));
 #else  #else
                 AIT_LEN(val) = be32toh(AIT_LEN(&v[i]));                  AIT_LEN(val) = be32toh(AIT_LEN(&v[i]));
                   AIT_HASH(val) = be16toh(AIT_HASH(&v[i]));
 #endif  #endif
   
                 switch (AIT_TYPE(val)) {                  switch (AIT_TYPE(val)) {
Line 241  io_buffer2vars(u_char *buf, int buflen, int vnum, int  Line 246  io_buffer2vars(u_char *buf, int buflen, int vnum, int 
   
 /*  /*
  * io_vars2map() Marshaling data from array with variables to memory map   * io_vars2map() Marshaling data from array with variables to memory map
    *
  * @buf = Buffer   * @buf = Buffer
  * @buflen = Size of buffer   * @buflen = Size of buffer
  * @vars = Variable array   * @vars = Variable array
Line 278  io_vars2map(u_char *buf, int buflen, array_t *vars) Line 284  io_vars2map(u_char *buf, int buflen, array_t *vars)
                 val = io_array(vars, i, ait_val_t*);                  val = io_array(vars, i, ait_val_t*);
   
                 v[i].val_type = val->val_type;                  v[i].val_type = val->val_type;
                   AIT_HASH(&v[i]) = AIT_HASH(val);
                 AIT_LEN(&v[i]) = AIT_LEN(val);                  AIT_LEN(&v[i]) = AIT_LEN(val);
   
                 switch (AIT_TYPE(val)) {                  switch (AIT_TYPE(val)) {
Line 320  io_vars2map(u_char *buf, int buflen, array_t *vars) Line 327  io_vars2map(u_char *buf, int buflen, array_t *vars)
   
 /*  /*
  * io_map2vars() De-marshaling data from memory map to array with variables   * io_map2vars() De-marshaling data from memory map to array with variables
    *
  * @buf = Buffer   * @buf = Buffer
  * @buflen = Size of buffer   * @buflen = Size of buffer
  * @vnum = Number of variables into buffer   * @vnum = Number of variables into buffer
Line 368  io_map2vars(u_char *buf, int buflen, int vnum, int zcp Line 376  io_map2vars(u_char *buf, int buflen, int vnum, int zcp
                 io_arraySet(vars, i, val);                  io_arraySet(vars, i, val);
   
                 val->val_type = v[i].val_type;                  val->val_type = v[i].val_type;
                   AIT_HASH(val) = AIT_HASH(&v[i]);
                 AIT_LEN(val) = AIT_LEN(&v[i]);                  AIT_LEN(val) = AIT_LEN(&v[i]);
   
                 switch (AIT_TYPE(val)) {                  switch (AIT_TYPE(val)) {
Line 425  io_map2vars(u_char *buf, int buflen, int vnum, int zcp Line 434  io_map2vars(u_char *buf, int buflen, int vnum, int zcp
   
 /*  /*
  * io_allocVars() Allocate ait_val_t array   * io_allocVars() Allocate ait_val_t array
    *
  * @varnum = Number of variables   * @varnum = Number of variables
  * return: =NULL error or !=NULL allocated array   * return: =NULL error or !=NULL allocated array
  */   */
Line 455  io_allocVars(int varnum) Line 465  io_allocVars(int varnum)
   
 /*  /*
  * io_clrVars() Clear ait_val_t elements from array   * io_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
  */   */
Line 475  io_clrVars(array_t * __restrict vars) Line 486  io_clrVars(array_t * __restrict vars)
   
 /*  /*
  * io_freeVars() Free ait_val_t array   * io_freeVars() Free ait_val_t array
    *
  * @vars = Variable array   * @vars = Variable array
  * return: none   * return: none
  */   */
Line 491  io_freeVars(array_t ** __restrict vars) Line 503  io_freeVars(array_t ** __restrict vars)
   
 /*  /*
  * io_allocVar() Allocate memory for variable   * io_allocVar() Allocate memory for variable
    *
  * return: NULL error or new variable, after use free variable with io_freeVar()   * return: NULL error or new variable, after use free variable with io_freeVar()
  */   */
 inline ait_val_t *  inline ait_val_t *
Line 511  io_allocVar(void) Line 524  io_allocVar(void)
   
 /*  /*
  * io_freeVar() Free allocated memory for variable   * io_freeVar() Free allocated memory for variable
    *
  * @val = Variable   * @val = Variable
  * return: none   * return: none
  */   */
 inline void  inline void
io_freeVar(ait_val_t ** __restrict val)io_freeVar(ait_val_t * __restrict val)
 {  {
        if (val && *val) {        if (val) {
                AIT_FREE_VAL(*val);                AIT_FREE_VAL(val);
                free(*val);                free(val);
                *val = NULL;                val = NULL;
         }          }
 }  }

Removed from v.1.3.2.1  
changed lines
  Added in v.1.4.4.2


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