Commit 01146582 authored by Torge Matthies's avatar Torge Matthies Committed by Alexandre Julliard

kernelbase: Break out of inner for-loop early in find_substring.

If I'm interpreting this code correctly, once either of these two if-conditions are true once, they will also be true at some point during all of the remaining iterations of the for-loop. Thus, we can just stop the for-loop here. Signed-off-by: 's avatarTorge Matthies <tmatthies@codeweavers.com>
parent b7cccbce
......@@ -3924,8 +3924,12 @@ static int find_substring( const struct sortguid *sortid, DWORD flags, const WCH
pos += append_weights( sortid, flags, src, srclen, pos,
case_mask, except, compr_tables, &s, TRUE );
if (s.primary_pos + s.key_primary.len > val.key_primary.len) goto next;
if (memcmp( primary, val.key_primary.buf + s.primary_pos, s.key_primary.len )) goto next;
if (s.primary_pos + s.key_primary.len > val.key_primary.len ||
memcmp( primary, val.key_primary.buf + s.primary_pos, s.key_primary.len ))
{
len = srclen + 1;
goto next;
}
s.primary_pos += s.key_primary.len;
s.key_primary.len = 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment