tree-wide: replace strstr(a, b) == a with spa_strstartswith()

spa_strstartswith() is more immediately understandable.

Coccinelle spatch file:
	@@
	expression E1, E2;
	@@
	- strstr(E1, E2) != E1
	+ !spa_strstartswith(E1, E2)

	@@
	expression E1, E2;
	@@
	- strstr(E1, E2) == E1
	+ spa_strstartswith(E1, E2)

Applied to the tree except for alsa/acp/compat.h because it looks like
that header is still mostly as-is from PA.
This commit is contained in:
Peter Hutterer 2021-08-02 14:05:45 +10:00 committed by Wim Taymans
parent 60c510d766
commit 51a177eb6d
20 changed files with 48 additions and 48 deletions

View file

@ -154,7 +154,7 @@ static struct node *v4l2_create_node(struct device *dev, uint32_t id,
str = pw_properties_get(dev->props, SPA_KEY_DEVICE_ALIAS);
if (str == NULL)
str = "v4l2-device";
if (strstr(str, "v4l2_device.") == str)
if (spa_strstartswith(str, "v4l2_device."))
str += 12;
if (strstr(info->factory_name, "sink") != NULL)