From: Wilfried Goesgens Date: Tue, 7 Dec 2010 22:20:43 +0000 (+0100) Subject: Performance: use memchr to find the next '-' and then call memcmp to check whether... X-Git-Tag: v8.01~530^2~1 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=486475be347640c7da6855e6994c6a54b48526cd Performance: use memchr to find the next '-' and then call memcmp to check whether this is a boundary - we fast forward to the next '-' since every mime boundary starts with '-' - from a '-' we check thorough whether at this point we can find the searched boundary Thanks to cirrus for pointing me to memchr() --- diff --git a/libcitadel/lib/mime_parser.c b/libcitadel/lib/mime_parser.c index 3b10588b7..7e4cbfb22 100644 --- a/libcitadel/lib/mime_parser.c +++ b/libcitadel/lib/mime_parser.c @@ -536,8 +536,13 @@ static char *FindNextContent(char *ptr, if (pptr < content_end) ptr = pptr; } + + next_boundary = NULL; - for (srch=ptr; srchb[startary].Key, m->b[startary].len)) @@ -545,6 +550,8 @@ static char *FindNextContent(char *ptr, next_boundary = srch; srch = content_end; } + else srch ++; + } }