PRInt32 L = PL_strlen(result);
PRInt32 L = nsCRT::strlen(result);
MimeHeaders_get (MimeHeaders *hdrs, const char *header_name,				 PRBool strip_p, PRBool all_p){  int i;  int name_length;  char *result = 0;/*  PR_ASSERT(hdrs); cause delete message problem in WinFE */  if (!hdrs) return 0;  PR_ASSERT(header_name);  if (!header_name) return 0;  /* Specifying strip_p and all_p at the same time doesn't make sense... */  PR_ASSERT(!(strip_p && all_p));  /* One shouldn't be trying to read headers when one hasn't finished	 parsing them yet... but this can happen if the message ended	 prematurely, and has no body at all (as opposed to a null body,	 which is more normal.)   So, if we try to read from the headers,	 let's assume that the headers are now finished.  If they aren't	 in fact finished, then a later attempt to write to them will assert.   */  if (!hdrs->done_p)	{	  int status;	  hdrs->done_p = PR_TRUE;	  status = MimeHeaders_build_heads_list(hdrs);	  if (status < 0) return 0;	}  if (!hdrs->heads)	  /* Must not have been any headers. */	{	  PR_ASSERT(hdrs->all_headers_fp == 0);	  return 0;	}  name_length = PL_strlen(header_name);  for (i = 0; i < hdrs->heads_size; i++)	{	  char *head = hdrs->heads[i];	  char *end = (i == hdrs->heads_size-1				   ? hdrs->all_headers + hdrs->all_headers_fp				   : hdrs->heads[i+1]);	  char *colon, *ocolon;	  PR_ASSERT(head);	  if (!head) continue;	  /* Quick hack to skip over BSD Mailbox delimiter. */	  if (i == 0 && head[0] == 'F' && !PL_strncmp(head, "From ", 5))		continue;	  /* Find the colon. */	  for (colon = head; colon < end; colon++)		if (*colon == ':') break;	  if (colon >= end) continue;	  /* Back up over whitespace before the colon. */	  ocolon = colon;	  for (; colon > head && IS_SPACE(colon[-1]); colon--)		;	  /* If the strings aren't the same length, it doesn't match. */	  if (name_length != colon - head )		continue;	  /* If the strings differ, it doesn't match. */	  if (PL_strncasecmp(header_name, head, name_length))		continue;	  /* Otherwise, we've got a match. */	  {		char *contents = ocolon + 1;		char *s;		/* Skip over whitespace after colon. */		while (contents <= end && IS_SPACE(*contents))		  contents++;		/* If we're supposed to strip at the frist token, pull `end' back to		   the first whitespace or ';' after the first token.		 */		if (strip_p)		  {			for (s = contents;				 s <= end && *s != ';' && *s != ',' && !IS_SPACE(*s);				 s++)			  ;			end = s;		  }		/* Now allocate some storage.		   If `result' already has a value, enlarge it.		   Otherwise, just allocate a block.		   `s' gets set to the place where the new data goes.		 */		if (!result)		  {			result = (char *) PR_MALLOC(end - contents + 1);			if (!result)			  return 0;			s = result;		  }		else		  {			PRInt32 L = PL_strlen(result);			s = (char *) PR_Realloc(result, (L + (end - contents + 10)));			if (!s)			  {				PR_Free(result);				return 0;			  }			result = s;			s = result + L;			/* Since we are tacking more data onto the end of the header			   field, we must make it be a well-formed continuation line,			   by seperating the old and new data with CR-LF-TAB.			 */			*s++ = ',';				/* #### only do this for addr headers? */			*s++ = MSG_LINEBREAK[0];# if (MSG_LINEBREAK_LEN == 2)			*s++ = MSG_LINEBREAK[1];# endif			*s++ = '\t';		  }		/* Take off trailing whitespace... */		while (end > contents && IS_SPACE(end[-1]))		  end--;		if (end > contents)		  {		    /* Now copy the header's contents in...		     */		    nsCRT::memcpy(s, contents, end - contents);		    s[end - contents] = 0;		  }		else		  {		    s[0] = 0;		  }		/* If we only wanted the first occurence of this header, we're done. */		if (!all_p) break;	  }	}  if (result && !*result)  /* empty string */	{	  PR_Free(result);	  return 0;	}  return result;}