http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4707
------- Additional Comments From [EMAIL PROTECTED] 2005-11-28 02:49 -------
Without looking at the code, and assuming this is a once per message thing, or
the source buffer is typically rather small (<10KB, say) I would probably do
something like
int sourcelen = strlen (sourcebuf);
char *upperbuf = malloc (sourcelen+1);
static char key[] = {"\nDATA\n"};
static int keylen = strlen(key);
if (upperbuf)
{
char *p = upperbuf-1;
strcpy (upperbuf, sourcebuf);
strupr (upperbuf);
for ( ; p = strchr (p+1, '\n') && sourcelen-(p-upperbuf) <= keylen; )
{
if (memcmp (p, key, keylen) == 0)
{
// we found the key!
break;
}
}
free (upperbuf);
}
If this is a once-per-line thing, I would keep the upperbuf around for the
length of the message, only expanding it as needed with a realloc now and then.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.