QWindowsNativeInterface: don't allocate memory just to compare strings
Change-Id: I691d2629a78aaaee3d1741b9ab4c55b16c95bde9 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
2e3facf419
commit
e311f7ac8b
@ -64,7 +64,7 @@ enum ResourceType {
|
||||
|
||||
static int resourceType(const QByteArray &key)
|
||||
{
|
||||
static const QByteArray names[] = { // match ResourceType
|
||||
static const char *names[] = { // match ResourceType
|
||||
"renderingcontext",
|
||||
"eglcontext",
|
||||
"egldisplay",
|
||||
@ -74,8 +74,8 @@ static int resourceType(const QByteArray &key)
|
||||
"getdc",
|
||||
"releasedc"
|
||||
};
|
||||
const QByteArray *end = names + sizeof(names) / sizeof(names[0]);
|
||||
const QByteArray *result = std::find(names, end, key);
|
||||
const char ** const end = names + sizeof(names) / sizeof(names[0]);
|
||||
const char **result = std::find(names, end, key);
|
||||
if (result == end)
|
||||
result = std::find(names, end, key.toLower());
|
||||
return int(result - names);
|
||||
|
Loading…
Reference in New Issue
Block a user