Diff for /libaitcfg/src/parse.c between versions 1.10.2.2 and 1.10.2.3

version 1.10.2.2, 2012/08/30 13:49:44 version 1.10.2.3, 2012/08/30 14:16:51
Line 361  cfgReadLines(FILE *f, const char *delim, const char *e Line 361  cfgReadLines(FILE *f, const char *delim, const char *e
 {  {
         char line[BUFSIZ];          char line[BUFSIZ];
         struct tagCfg *d, *av = NULL;          struct tagCfg *d, *av = NULL;
        char *psAttr, *psVal = NULL;        char *p, *psSec, *psAttr, *psVal;
   
         if (!cfg)          if (!cfg)
                 return -1;                  return -1;
Line 369  cfgReadLines(FILE *f, const char *delim, const char *e Line 369  cfgReadLines(FILE *f, const char *delim, const char *e
                 delim = ATR_LINES_DELIM;                  delim = ATR_LINES_DELIM;
   
         while (!feof(f)) {          while (!feof(f)) {
                   psSec = psAttr = psVal = NULL;
                 memset(line, 0, sizeof line);                  memset(line, 0, sizeof line);
                 fgets(line, sizeof line - 1, f);                  fgets(line, sizeof line - 1, f);
                 /* check for user end-of-file */                  /* check for user end-of-file */
Line 385  cfgReadLines(FILE *f, const char *delim, const char *e Line 386  cfgReadLines(FILE *f, const char *delim, const char *e
                                 continue;                                  continue;
                 }                  }
   
                if (!io_MakeAV2(line, delim, &psAttr, &psVal))                if (!io_MakeAV2(line, delim, &p, &psVal))
                         continue;                          continue;
                 else {                  else {
                           io_RTrimStr(p);
                         io_LTrimStr(psVal);                          io_LTrimStr(psVal);
                         io_RTrimStr(psAttr);  
                 }                  }
                   if (!io_MakeAV2(p, SEC_LINES_DELIM, &psSec, &psAttr))
                           psAttr = p;
   
                 /* *NEW PAIR* alloc new pair element */                  /* *NEW PAIR* alloc new pair element */
                 av = io_malloc(sizeof(struct tagCfg));                  av = io_malloc(sizeof(struct tagCfg));
Line 400  cfgReadLines(FILE *f, const char *delim, const char *e Line 403  cfgReadLines(FILE *f, const char *delim, const char *e
                 } else                  } else
                         memset(av, 0, sizeof(struct tagCfg));                          memset(av, 0, sizeof(struct tagCfg));
   
                   if (psSec) {
                           AIT_SET_STR(&av->cfg_sec, psSec);
                           AIT_KEY(&av->cfg_sec) = crcFletcher16(AIT_GET_LIKE(&av->cfg_sec, u_short*), 
                                           io_align(AIT_LEN(&av->cfg_sec) - 1, 1) / 2);
                   }
                 if (psVal)                  if (psVal)
                         AIT_SET_STR(&av->cfg_val, psVal);                          AIT_SET_STR(&av->cfg_val, psVal);
                 AIT_SET_STR(&av->cfg_attr, psAttr);                  AIT_SET_STR(&av->cfg_attr, psAttr);

Removed from v.1.10.2.2  
changed lines
  Added in v.1.10.2.3


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