Diff for /libaitwww/src/tools.c between versions 1.2.6.1 and 1.3

version 1.2.6.1, 2012/07/31 11:56:16 version 1.3, 2012/08/01 00:40:41
Line 60  www_cmp(const char *ct, const char *s) Line 60  www_cmp(const char *ct, const char *s)
   
         assert(ct && s);          assert(ct && s);
   
        while (isspace(*ct))        while (isspace((int) *ct))
                 ct++;                  ct++;
   
         if (!(sc = strchr(ct, ';')))          if (!(sc = strchr(ct, ';')))
                 sc = strchr(ct, '\x0');                  sc = strchr(ct, '\x0');
        while (isspace(*(sc - 1)))        while (isspace((int) *(sc - 1)))
                 sc--;                  sc--;
   
         if (strlen(s) != sc - ct)          if (strlen(s) != sc - ct)
Line 87  www_cmptype(const char *ct, const char *type) Line 87  www_cmptype(const char *ct, const char *type)
   
         assert(ct && type);          assert(ct && type);
   
        while (isspace(*ct))        while (isspace((int) *ct))
                 ct++;                  ct++;
   
         if (!(sl = strchr(ct, '/')))          if (!(sl = strchr(ct, '/')))
Line 103  www_cmptype(const char *ct, const char *type) Line 103  www_cmptype(const char *ct, const char *type)
  *   *
  * @str = query string   * @str = query string
  * @delim = delimiter   * @delim = delimiter
 * return: NULL error or AV pair, must be free() after use! * return: NULL error or AV pair, must be io_free() after use!
  */   */
char *ait_val_t *
 www_getpair(char ** __restrict str, const char *delim)  www_getpair(char ** __restrict str, const char *delim)
 {  {
        char *tr, *s = NULL;        char *tr;
         int cx;          int cx;
           ait_val_t *s;
   
         assert(str && *str && delim);          assert(str && *str && delim);
   
           s = io_allocVar();
           if (!s) {
                   www_SetErr(io_GetErrno(), "%s", io_GetError());
                   return NULL;
           }
   
         cx = strcspn(*str, delim);          cx = strcspn(*str, delim);
         tr = *str + cx;          tr = *str + cx;
           if (*tr)
                   *tr++ = 0;
   
        s = malloc(cx + 1);        AIT_SET_STR(s, *str);
        if (!s) { 
                LOGERR; 
                return NULL; 
        } else 
                strlcpy(s, *str, cx + 1); 
   
         *str = tr;          *str = tr;
         if (**str)  
                 (*str)++;  
   
         return s;          return s;
 }  }
   
Line 161  www_unescape(char * __restrict str) Line 162  www_unescape(char * __restrict str)
 {  {
         register int i, j;          register int i, j;
   
        assert(str);        if (!str)
                 return;
   
         for (i = j = 0; str[j]; i++, j++) {          for (i = j = 0; str[j]; i++, j++) {
                 str[i] = str[j];                  str[i] = str[j];

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


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