mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
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:
parent
60c510d766
commit
51a177eb6d
20 changed files with 48 additions and 48 deletions
|
|
@ -412,9 +412,9 @@ static const struct a2dp_codec *a2dp_endpoint_to_codec(const char *endpoint)
|
|||
const char *codec_name;
|
||||
int i;
|
||||
|
||||
if (strstr(endpoint, A2DP_SINK_ENDPOINT "/") == endpoint)
|
||||
if (spa_strstartswith(endpoint, A2DP_SINK_ENDPOINT "/"))
|
||||
codec_name = endpoint + strlen(A2DP_SINK_ENDPOINT "/");
|
||||
else if (strstr(endpoint, A2DP_SOURCE_ENDPOINT "/") == endpoint)
|
||||
else if (spa_strstartswith(endpoint, A2DP_SOURCE_ENDPOINT "/"))
|
||||
codec_name = endpoint + strlen(A2DP_SOURCE_ENDPOINT "/");
|
||||
else
|
||||
return NULL;
|
||||
|
|
@ -430,9 +430,9 @@ static const struct a2dp_codec *a2dp_endpoint_to_codec(const char *endpoint)
|
|||
static int a2dp_endpoint_to_profile(const char *endpoint)
|
||||
{
|
||||
|
||||
if (strstr(endpoint, A2DP_SINK_ENDPOINT "/") == endpoint)
|
||||
if (spa_strstartswith(endpoint, A2DP_SINK_ENDPOINT "/"))
|
||||
return SPA_BT_PROFILE_A2DP_SOURCE;
|
||||
else if (strstr(endpoint, A2DP_SOURCE_ENDPOINT "/") == endpoint)
|
||||
else if (spa_strstartswith(endpoint, A2DP_SOURCE_ENDPOINT "/"))
|
||||
return SPA_BT_PROFILE_A2DP_SINK;
|
||||
else
|
||||
return SPA_BT_PROFILE_NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue