if (!comment) {
if (!comment && !angle_addr) {
RFC822AddressList * construct_addresslist(char *s){  PRBool  quoted = PR_FALSE, angle_addr = PR_FALSE;  PRInt32  comment = 0;  char *displayname = nsnull, *addrspec = nsnull;  static RFC822AddressList  listinit;  RFC822AddressList  *listhead = (RFC822AddressList *)PR_Malloc(sizeof(RFC822AddressList));  RFC822AddressList  *list = listhead;  if (!list)    return nsnull;  while (*s == ' ' || *s == TAB)    ++s;  for (*list = listinit; *s; ++s) {    if (*s == '\\') {      if (quoted || comment) {        ++s;        continue;      }    }    else if (*s == '(' || *s == ')') {      if (!quoted) {        if (*s == '(') {          if (comment++ == 0)            displayname = s + 1;        }        else {          if (--comment == 0) {            *s = '\0';            PR_FREEIF(list->displayname);            list->displayname = nsCRT::strdup(displayname);            list->asciionly = intlmime_only_ascii_str(displayname);            *s = ')';          }        }        continue;      }    }    else if (*s == '"') {      if (!comment) {        quoted = !quoted;        if (quoted)          displayname = s;        else {          char tmp = *(s+1);          *(s+1) = '\0';          PR_FREEIF(list->displayname);          list->displayname = nsCRT::strdup(displayname);          list->asciionly = intlmime_only_ascii_str(displayname);          *(s+1) = tmp;        }        continue;      }    }    else if (*s == '<' || *s == '>') {      if (!quoted && !comment) {        if (*s == '<') {          angle_addr = PR_TRUE;          addrspec = s;          if (displayname) {            char *e = s - 1, tmp;            while (*e == TAB || *e == ' ')              --e;            tmp = *++e;            *e = '\0';            PR_FREEIF(list->displayname);            list->displayname = nsCRT::strdup(displayname);            list->asciionly = intlmime_only_ascii_str(displayname);            *e = tmp;          }        }        else {          char tmp;          angle_addr = PR_FALSE;          tmp = *(s+1);          *(s+1) = '\0';          PR_FREEIF(list->addrspec);          list->addrspec = nsCRT::strdup(addrspec);          *(s+1) = tmp;        }        continue;      }    }    if (!quoted && !comment && !angle_addr) {      /* address-list separator. end of this address */      if (*s == ',') {        /* deal with addr-spec only address */        if (!addrspec && displayname) {          *s = '\0';          list->addrspec = nsCRT::strdup(displayname);          /* and don't forget to free the display name in the list, in that case it's bogus */          PR_FREEIF(list->displayname);        }        /* prepare for next address */        addrspec = displayname = nsnull;        list->next = (RFC822AddressList *)PR_Malloc(sizeof(RFC822AddressList));        list = list->next;        *list = listinit;        /* eat spaces */        ++s;        while (*s == ' ' || *s == TAB)          ++s;        if (*s == '\r' && *(s+1) == '\n' && (*(s+2) == ' ' || *(s+2) == TAB))          s += 2;        else          --s;      }      else if (!displayname && *s != ' ' && *s != TAB)        displayname = s;    }  }  /* deal with addr-spec only address comes at last */  if (!addrspec && displayname)  {    list->addrspec = nsCRT::strdup(displayname);    /* and don't forget to free the display name in the list, in that case it's bogus */    PR_FREEIF(list->displayname);  }  return listhead;}