mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-18 07:00:06 -05:00
treewide: replace strcmp() == 0 with spa_streq()
This change is only done in source files for now, header files will be done separately.
This commit is contained in:
parent
d8a9534a9a
commit
7697ed0757
130 changed files with 817 additions and 675 deletions
|
|
@ -42,6 +42,7 @@
|
|||
#include <spa/utils/names.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/json.h>
|
||||
#include <spa/utils/string.h>
|
||||
#include <spa/param/props.h>
|
||||
#include <spa/pod/builder.h>
|
||||
#include <spa/pod/parser.h>
|
||||
|
|
@ -145,7 +146,7 @@ static struct node *alsa_find_node(struct device *device, uint32_t id, const cha
|
|||
return node;
|
||||
if (name != NULL &&
|
||||
(str = pw_properties_get(node->props, PW_KEY_NODE_NAME)) != NULL &&
|
||||
strcmp(name, str) == 0)
|
||||
spa_streq(name, str))
|
||||
return node;
|
||||
}
|
||||
return NULL;
|
||||
|
|
@ -208,30 +209,30 @@ static void update_icon_name(struct pw_properties *p, bool is_sink)
|
|||
const char *s, *d = NULL, *bus;
|
||||
|
||||
if ((s = pw_properties_get(p, PW_KEY_DEVICE_FORM_FACTOR))) {
|
||||
if (strcmp(s, "microphone") == 0)
|
||||
if (spa_streq(s, "microphone"))
|
||||
d = "audio-input-microphone";
|
||||
else if (strcmp(s, "webcam") == 0)
|
||||
else if (spa_streq(s, "webcam"))
|
||||
d = "camera-web";
|
||||
else if (strcmp(s, "computer") == 0)
|
||||
else if (spa_streq(s, "computer"))
|
||||
d = "computer";
|
||||
else if (strcmp(s, "handset") == 0)
|
||||
else if (spa_streq(s, "handset"))
|
||||
d = "phone";
|
||||
else if (strcmp(s, "portable") == 0)
|
||||
else if (spa_streq(s, "portable"))
|
||||
d = "multimedia-player";
|
||||
else if (strcmp(s, "tv") == 0)
|
||||
else if (spa_streq(s, "tv"))
|
||||
d = "video-display";
|
||||
else if (strcmp(s, "headset") == 0)
|
||||
else if (spa_streq(s, "headset"))
|
||||
d = "audio-headset";
|
||||
else if (strcmp(s, "headphone") == 0)
|
||||
else if (spa_streq(s, "headphone"))
|
||||
d = "audio-headphones";
|
||||
else if (strcmp(s, "speaker") == 0)
|
||||
else if (spa_streq(s, "speaker"))
|
||||
d = "audio-speakers";
|
||||
else if (strcmp(s, "hands-free") == 0)
|
||||
else if (spa_streq(s, "hands-free"))
|
||||
d = "audio-handsfree";
|
||||
}
|
||||
if (!d)
|
||||
if ((s = pw_properties_get(p, PW_KEY_DEVICE_CLASS)))
|
||||
if (strcmp(s, "modem") == 0)
|
||||
if (spa_streq(s, "modem"))
|
||||
d = "modem";
|
||||
|
||||
if (!d) {
|
||||
|
|
@ -524,7 +525,7 @@ static struct device *alsa_find_device(struct impl *impl, uint32_t id, const cha
|
|||
return device;
|
||||
if (name != NULL &&
|
||||
(str = pw_properties_get(device->props, PW_KEY_DEVICE_NAME)) != NULL &&
|
||||
strcmp(str, name) == 0)
|
||||
spa_streq(str, name))
|
||||
return device;
|
||||
}
|
||||
return NULL;
|
||||
|
|
@ -581,11 +582,11 @@ static int update_device_props(struct device *device)
|
|||
d = NULL;
|
||||
|
||||
if ((s = pw_properties_get(p, PW_KEY_DEVICE_FORM_FACTOR)))
|
||||
if (strcmp(s, "internal") == 0)
|
||||
if (spa_streq(s, "internal"))
|
||||
d = _("Built-in Audio");
|
||||
if (!d)
|
||||
if ((s = pw_properties_get(p, PW_KEY_DEVICE_CLASS)))
|
||||
if (strcmp(s, "modem") == 0)
|
||||
if (spa_streq(s, "modem"))
|
||||
d = _("Modem");
|
||||
if (!d)
|
||||
d = pw_properties_get(p, PW_KEY_DEVICE_PRODUCT_NAME);
|
||||
|
|
@ -756,7 +757,7 @@ static void reserve_busy(void *data, struct rd_device *d, const char *name, int3
|
|||
|
||||
device->sdevice->locked = true;
|
||||
|
||||
if (strcmp(name, "jack") == 0) {
|
||||
if (spa_streq(name, "jack")) {
|
||||
add_jack_timeout(impl);
|
||||
} else {
|
||||
remove_jack_timeout(impl);
|
||||
|
|
@ -775,7 +776,7 @@ static void reserve_available(void *data, struct rd_device *d, const char *name)
|
|||
device->sdevice->locked = false;
|
||||
|
||||
remove_jack_timeout(impl);
|
||||
if (strcmp(name, "jack") == 0) {
|
||||
if (spa_streq(name, "jack")) {
|
||||
set_jack_profile(impl, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue