Example my assembly with gcc -02 flag
Before: ![screen_before](/uploads/f2bf5f4c793c159c31ac42b635c46d5a/screen_before.jpg)
After: ![screen_after](/uploads/051315ad1e3c064046446782d36e1a29/screen_after.jpg)
-- v5: d3dcompiler_43: micro-optimization using strstr -> strchr implementation if possible wusa: micro-optimization using strstr -> strchr implementation if possible oledb32: micro-optimization using strstr -> strchr implementation if possible wbemprox: micro-optimization using strstr -> strchr implementation if possible oledb32: micro-optimization using strstr -> strchr implementation if possible wusa: micro-optimization using strstr -> strchr implementation if possible msidb: micro-optimization using strstr -> strchr implementation if possible
From: Semenov Herman (Семенов Герман)GermanAizek@yandex.ru
--- programs/msidb/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/msidb/main.c b/programs/msidb/main.c index 8570b1f9f3d..3851c160736 100644 --- a/programs/msidb/main.c +++ b/programs/msidb/main.c @@ -449,7 +449,7 @@ static int import_tables( struct msidb_state *state ) WCHAR *ext;
/* permit specifying tables with wildcards ('Feature*') */ - if (wcsstr( table_name, L"*" ) != NULL) + if (wcschr( table_name, '*' ) != NULL) { WIN32_FIND_DATAW f; HANDLE handle;
From: Semenov Herman (Семенов Герман)GermanAizek@yandex.ru
--- programs/wusa/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/wusa/main.c b/programs/wusa/main.c index ef7302847cc..1cb2e5c856c 100644 --- a/programs/wusa/main.c +++ b/programs/wusa/main.c @@ -684,7 +684,7 @@ static WCHAR *parse_multisz(const WCHAR *input, DWORD *size) for (pos = input; pos[0] == '"'; pos++) { pos++; - if (!(next = wcsstr(pos, L"""))) goto error; + if (!(next = wcschr(pos, '"'))) goto error; strbuf_append(&buf, pos, next - pos); strbuf_append(&buf, L"", ARRAY_SIZE(L""));
From: Semenov Herman (Семенов Герман)GermanAizek@yandex.ru
--- dlls/oledb32/datainit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/oledb32/datainit.c b/dlls/oledb32/datainit.c index 01e8f5c1b57..4beef469a96 100644 --- a/dlls/oledb32/datainit.c +++ b/dlls/oledb32/datainit.c @@ -834,7 +834,7 @@ static int get_propvalue_length(DBPROP *prop) { length = SysStringLen(V_BSTR(&str)); /* Quotes values with '"' if the value contains semicolons */ - if (wcsstr(V_BSTR(&str), L";")) + if (wcschr(V_BSTR(&str), ';')) length += 2; VariantClear(&str); return length;
From: Semenov Herman (Семенов Герман)GermanAizek@yandex.ru
--- dlls/wbemprox/query.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c index a6599334f58..b019b43d1e8 100644 --- a/dlls/wbemprox/query.c +++ b/dlls/wbemprox/query.c @@ -96,7 +96,7 @@ void destroy_view( struct view *view )
static BOOL eval_like( const WCHAR *text, const WCHAR *pattern ) { - if (wcsstr( pattern, L"[" )) FIXME( "character ranges (i.e. [abc], [^a-z]) are not supported\n" ); + if (wcschr( pattern, '[' )) FIXME( "character ranges (i.e. [abc], [^a-z]) are not supported\n" );
while (*text) {
From: Semenov Herman (Семенов Герман)GermanAizek@yandex.ru
--- dlls/oledb32/datainit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/oledb32/datainit.c b/dlls/oledb32/datainit.c index 4beef469a96..bbe0697b185 100644 --- a/dlls/oledb32/datainit.c +++ b/dlls/oledb32/datainit.c @@ -823,7 +823,7 @@ static int get_propvalue_length(DBPROP *prop) { length = SysStringLen(V_BSTR(v)); /* Quotes values with '"' if the value contains semicolons */ - if (wcsstr(V_BSTR(v), L";")) + if (wcschr(V_BSTR(v), ';')) length += 2; return length; } @@ -851,7 +851,7 @@ static void write_propvalue_str(WCHAR *str, DBPROP *prop)
if (V_VT(v) == VT_BSTR) { - if (wcsstr(V_BSTR(v), L";")) + if (wcschr(V_BSTR(v), ';')) { lstrcatW(str, L"""); lstrcatW(str, V_BSTR(v)); @@ -868,7 +868,7 @@ static void write_propvalue_str(WCHAR *str, DBPROP *prop) hr = VariantChangeType(&vstr, v, VARIANT_ALPHABOOL, VT_BSTR); if (hr == S_OK) { - if (wcsstr(V_BSTR(&vstr), L";")) + if (wcschr(V_BSTR(&vstr), ';')) { lstrcatW(str, L"""); lstrcatW(str, V_BSTR(&vstr));
From: Semenov Herman (Семенов Герман)GermanAizek@yandex.ru
--- programs/wusa/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/wusa/main.c b/programs/wusa/main.c index 1cb2e5c856c..4078051b017 100644 --- a/programs/wusa/main.c +++ b/programs/wusa/main.c @@ -542,7 +542,7 @@ static WCHAR *expand_expression(struct assembly_entry *assembly, const WCHAR *ex { strbuf_append(&buf, pos, next - pos); pos = next + 2; - if (!(next = wcsstr(pos, L")"))) + if (!(next = wcschr(pos, ')'))) { strbuf_append(&buf, L"$(", 2); break;
From: Semenov Herman (Семенов Герман)GermanAizek@yandex.ru
--- dlls/d3dcompiler_43/compiler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/d3dcompiler_43/compiler.c b/dlls/d3dcompiler_43/compiler.c index 6fffcfb82ab..5059deee9f1 100644 --- a/dlls/d3dcompiler_43/compiler.c +++ b/dlls/d3dcompiler_43/compiler.c @@ -176,7 +176,7 @@ static const char *get_line(const char **ptr) const char *p, *q;
p = *ptr; - if (!(q = strstr(p, "\n"))) + if (!(q = strchr(p, '\n'))) { if (!*p) return NULL;
Done, I also found more similar places where this feature is applicable, it is also more readable because we know that we have char and not string.