param: Avoid strcmps

Most of the time, we are dealing with static strings,
and we can compare them directly and avoid the strcmp.

Note that triggering this optimization requires
properties to be marked as G_PARAM_STATIC_NAME.
This commit is contained in:
Matthias Clasen 2022-05-19 18:45:58 -04:00
parent 6b5b1cd314
commit 91dafa85fc

View File

@ -923,7 +923,8 @@ param_spec_pool_equals (gconstpointer key_spec_1,
const GParamSpec *key2 = key_spec_2; const GParamSpec *key2 = key_spec_2;
return (key1->owner_type == key2->owner_type && return (key1->owner_type == key2->owner_type &&
strcmp (key1->name, key2->name) == 0); (key1->name == key2->name ||
strcmp (key1->name, key2->name) == 0));
} }
/** /**