char *s = (char *)PR_Realloc(hdrs->all_headers, hdrs->all_headers_fp); if (s)
char *ls = (char *)PR_Realloc(hdrs->all_headers, hdrs->all_headers_fp); if (ls)
MimeHeaders_build_heads_list(MimeHeaders *hdrs){  char *s;  char *end;  int i;  PR_ASSERT(hdrs);  if (!hdrs) return -1;  PR_ASSERT(hdrs->done_p && !hdrs->heads);  if (!hdrs->done_p || hdrs->heads)	return -1;  if (hdrs->all_headers_fp == 0)	{	  /* Must not have been any headers (we got the blank line right away.) */	  PR_FREEIF (hdrs->all_headers);	  hdrs->all_headers_size = 0;	  return 0;	}  /* At this point, we might as well realloc all_headers back down to the	 minimum size it must be (it could be up to 1k bigger.)  But don't	 bother if we're only off by a tiny bit. */  PR_ASSERT(hdrs->all_headers_fp <= hdrs->all_headers_size);  if (hdrs->all_headers_fp + 60 <= hdrs->all_headers_size)	{	  char *s = (char *)PR_Realloc(hdrs->all_headers, hdrs->all_headers_fp);	  if (s) /* can this ever fail?  we're making it smaller... */		{		  hdrs->all_headers = s;  /* in case it got relocated */		  hdrs->all_headers_size = hdrs->all_headers_fp;		}	}  /* First go through and count up the number of headers in the block.   */  end = hdrs->all_headers + hdrs->all_headers_fp;  for (s = hdrs->all_headers; s <= end-1; s++)	{	  if (s <= (end-1) && s[0] == CR && s[1] == LF) /* CRLF -> LF */		s++;	  if ((s[0] == CR || s[0] == LF) &&			/* we're at a newline, and */		  (s >= (end-1) ||						/* we're at EOF, or */		   !(s[1] == ' ' || s[1] == '\t')))		/* next char is nonwhite */		hdrs->heads_size++;	}	    /* Now allocate storage for the pointers to each of those headers.   */  hdrs->heads = (char **) PR_MALLOC((hdrs->heads_size + 1) * sizeof(char *));  if (!hdrs->heads)	return MK_OUT_OF_MEMORY;  memset(hdrs->heads, 0, (hdrs->heads_size + 1) * sizeof(char *));  /* Now make another pass through the headers, and this time, record the	 starting position of each header.   */  i = 0;  hdrs->heads[i++] = hdrs->all_headers;  s = hdrs->all_headers;  while (s <= end)	{	SEARCH_NEWLINE:	  while (s <= end-1 && *s != CR && *s != LF)		s++;	  if (s+1 >= end)		break;	  /* If "\r\n " or "\r\n\t" is next, that doesn't terminate the header. */	  else if (s+2 < end &&			   (s[0] == CR  && s[1] == LF) &&			   (s[2] == ' ' || s[2] == '\t'))		{		  s += 3;		  goto SEARCH_NEWLINE;		}	  /* If "\r " or "\r\t" or "\n " or "\n\t" is next, that doesn't terminate		 the header either. */	  else if ((s[0] == CR  || s[0] == LF) &&			   (s[1] == ' ' || s[1] == '\t'))		{		  s += 2;		  goto SEARCH_NEWLINE;		}	  /* At this point, `s' points before a header-terminating newline.		 Move past that newline, and store that new position in `heads'.	   */	  if (*s == CR) s++;	  if (*s == LF) s++;	  if (s < end)		{		  PR_ASSERT(! (i > hdrs->heads_size));		  if (i > hdrs->heads_size) return -1;		  hdrs->heads[i++] = s;		}	}  return 0;}