Diff for /libaitsess/src/sess.c between versions 1.4 and 1.5

version 1.4, 2012/02/10 23:38:30 version 1.5, 2012/07/22 22:13:48
Line 63  sess_FreeValues(char *** __restrict ppsVals) Line 63  sess_FreeValues(char *** __restrict ppsVals)
                 return;                  return;
   
         for (ptr = *ppsVals; *ptr; ptr++)          for (ptr = *ppsVals; *ptr; ptr++)
                free(*ptr);                io_free(*ptr);
        free(*ppsVals);        io_free(*ppsVals);
         *ppsVals = NULL;          *ppsVals = NULL;
 }  }
   
Line 84  sess_GetValues(ait_sess_t * __restrict s, char ***ppsV Line 84  sess_GetValues(ait_sess_t * __restrict s, char ***ppsV
   
         if (!s || !ppsVals)          if (!s || !ppsVals)
                 return -1;                  return -1;
        valz = malloc(sizeof(caddr_t));        valz = io_malloc(sizeof(caddr_t));
         if (!valz) {          if (!valz) {
                 LOGERR;                  LOGERR;
                 return -1;                  return -1;
Line 92  sess_GetValues(ait_sess_t * __restrict s, char ***ppsV Line 92  sess_GetValues(ait_sess_t * __restrict s, char ***ppsV
                 *valz = NULL;                  *valz = NULL;
   
         // allocated memory & mirrored shared memory into this          // allocated memory & mirrored shared memory into this
        Shared = malloc(s->eom);        Shared = io_malloc(s->eom);
         if (!Shared) {          if (!Shared) {
                 LOGERR;                  LOGERR;
                free(valz);                io_free(valz);
                 return -1;                  return -1;
         } else          } else
                 memcpy(Shared, s->addr, s->eom);                  memcpy(Shared, s->addr, s->eom);
Line 107  sess_GetValues(ait_sess_t * __restrict s, char ***ppsV Line 107  sess_GetValues(ait_sess_t * __restrict s, char ***ppsV
                 else                  else
                         i++;                          i++;
   
                valz = realloc(valz, (i + 1) * sizeof(caddr_t));                valz = io_realloc(valz, (i + 1) * sizeof(caddr_t));
                 if (!valz) {                  if (!valz) {
                         LOGERR;                          LOGERR;
                        free(Shared);                        io_free(Shared);
                         return -1;                          return -1;
                 } else                  } else
                         valz[i] = NULL;                          valz[i] = NULL;
   
                valz[i - 1] = strdup(peer);                valz[i - 1] = io_strdup(peer);
         }          }
   
        free(Shared);        io_free(Shared);
         *ppsVals = valz;          *ppsVals = valz;
         return i;          return i;
 }  }
Line 151  sess_GetValue(ait_sess_t * __restrict s, const char *c Line 151  sess_GetValue(ait_sess_t * __restrict s, const char *c
         }          }
   
         // allocated memory & mirrored shared memory into this          // allocated memory & mirrored shared memory into this
        Shared = malloc(s->eom);        Shared = io_malloc(s->eom);
         if (!Shared) {          if (!Shared) {
                 LOGERR;                  LOGERR;
                 return -1;                  return -1;
Line 171  sess_GetValue(ait_sess_t * __restrict s, const char *c Line 171  sess_GetValue(ait_sess_t * __restrict s, const char *c
                         } else                          } else
                                 def = IS_DEF;                                  def = IS_DEF;
   
                        free(Shared);                        io_free(Shared);
                         return i | def;                          return i | def;
                 }                  }
         }          }
   
        free(Shared);        io_free(Shared);
         return 0;          return 0;
 }  }
   
Line 203  sess_DelValue(ait_sess_t * __restrict s, const char *c Line 203  sess_DelValue(ait_sess_t * __restrict s, const char *c
         strlcpy(szAttr, csAttr, sizeof szAttr);          strlcpy(szAttr, csAttr, sizeof szAttr);
         strlcat(szAttr, "=", sizeof szAttr);          strlcat(szAttr, "=", sizeof szAttr);
   
        Buffer = malloc(s->eom);        Buffer = io_malloc(s->eom);
         if (!Buffer) {          if (!Buffer) {
                 LOGERR;                  LOGERR;
                 return -1;                  return -1;
         } else          } else
                 memset(Buffer, 0, s->eom);                  memset(Buffer, 0, s->eom);
        Shared = malloc(s->eom);        Shared = io_malloc(s->eom);
         if (!Shared) {          if (!Shared) {
                 LOGERR;                  LOGERR;
                free(Buffer);                io_free(Buffer);
                 return -1;                  return -1;
         } else {          } else {
                 DEC_SEM(s);                  DEC_SEM(s);
Line 236  sess_DelValue(ait_sess_t * __restrict s, const char *c Line 236  sess_DelValue(ait_sess_t * __restrict s, const char *c
                 msync(s->addr, 0, MS_SYNC | MS_INVALIDATE);                  msync(s->addr, 0, MS_SYNC | MS_INVALIDATE);
   
         INC_SEM(s);          INC_SEM(s);
        free(Shared);        io_free(Shared);
        free(Buffer);        io_free(Buffer);
         return 0;          return 0;
 }  }
   
Line 265  sess_SetValue(ait_sess_t * __restrict s, const char *c Line 265  sess_SetValue(ait_sess_t * __restrict s, const char *c
         strlcpy(szAttr, csAttr, sizeof szAttr);          strlcpy(szAttr, csAttr, sizeof szAttr);
         strlcat(szAttr, "=", sizeof szAttr);          strlcat(szAttr, "=", sizeof szAttr);
   
        Buffer = malloc(s->eom);        Buffer = io_malloc(s->eom);
         if (!Buffer) {          if (!Buffer) {
                 LOGERR;                  LOGERR;
                 return -1;                  return -1;
         } else          } else
                 memset(Buffer, 0, s->eom);                  memset(Buffer, 0, s->eom);
        Shared = malloc(s->eom);        Shared = io_malloc(s->eom);
         if (!Shared) {          if (!Shared) {
                 LOGERR;                  LOGERR;
                free(Buffer);                io_free(Buffer);
                 return -1;                  return -1;
         } else {          } else {
                 DEC_SEM(s);                  DEC_SEM(s);
Line 320  sess_SetValue(ait_sess_t * __restrict s, const char *c Line 320  sess_SetValue(ait_sess_t * __restrict s, const char *c
                 msync(s->addr, 0, MS_SYNC | MS_INVALIDATE);                  msync(s->addr, 0, MS_SYNC | MS_INVALIDATE);
   
         INC_SEM(s);          INC_SEM(s);
        free(Shared);        io_free(Shared);
        free(Buffer);        io_free(Buffer);
         return upd | def;          return upd | def;
 }  }
   

Removed from v.1.4  
changed lines
  Added in v.1.5


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