Commit 7697ed07 authored by Peter Hutterer's avatar Peter Hutterer
Browse files

treewide: replace strcmp() == 0 with spa_streq()

This change is only done in source files for now, header files will be done
separately.
parent d8a9534a
......@@ -26,6 +26,7 @@
#include <alsa/control_external.h>
#include <spa/utils/result.h>
#include <spa/utils/string.h>
#include <spa/utils/json.h>
#include <spa/param/props.h>
#include <spa/param/audio/format-utils.h>
......@@ -163,11 +164,11 @@ static struct global *find_global(snd_ctl_pipewire_t *ctl, uint32_t id,
spa_list_for_each(g, &ctl->globals, link) {
if ((g->id == id || g->id == name_id) &&
(type == NULL || strcmp(g->ginfo->type, type) == 0))
(type == NULL || spa_streq(g->ginfo->type, type)))
return g;
if (name != NULL && name[0] != '\0' &&
(str = pw_properties_get(g->props, PW_KEY_NODE_NAME)) != NULL &&
strcmp(name, str) == 0)
spa_streq(name, str))
return g;
}
return NULL;
......@@ -177,7 +178,7 @@ static struct global *find_best_node(snd_ctl_pipewire_t *ctl, uint32_t flags)
{
struct global *g, *best = NULL;
spa_list_for_each(g, &ctl->globals, link) {
if ((strcmp(g->ginfo->type, PW_TYPE_INTERFACE_Node) == 0) &&
if ((spa_streq(g->ginfo->type, PW_TYPE_INTERFACE_Node)) &&
(flags == 0 || (g->node.flags & flags) == flags) &&
(best == NULL || best->node.priority < g->node.priority))
best = g;
......@@ -344,13 +345,13 @@ static snd_ctl_ext_key_t pipewire_find_elem(snd_ctl_ext_t * ext,
name = snd_ctl_elem_id_get_name(id);
if (strcmp(name, SOURCE_VOL_NAME) == 0)
if (spa_streq(name, SOURCE_VOL_NAME))
return 0;
if (strcmp(name, SOURCE_MUTE_NAME) == 0)
if (spa_streq(name, SOURCE_MUTE_NAME))
return 1;
if (strcmp(name, SINK_VOL_NAME) == 0)
if (spa_streq(name, SINK_VOL_NAME))
return 2;
if (strcmp(name, SINK_MUTE_NAME) == 0)
if (spa_streq(name, SINK_MUTE_NAME))
return 3;
return SND_CTL_EXT_KEY_NOT_FOUND;
......@@ -836,7 +837,7 @@ static struct global *find_node_for_route(snd_ctl_pipewire_t *ctl, uint32_t card
{
struct global *n;
spa_list_for_each(n, &ctl->globals, link) {
if (strcmp(n->ginfo->type, PW_TYPE_INTERFACE_Node) == 0 &&
if (spa_streq(n->ginfo->type, PW_TYPE_INTERFACE_Node) &&
(n->node.device_id == card) &&
(n->node.profile_device_id == device))
return n;
......@@ -925,9 +926,9 @@ static void node_event_info(void *object, const struct pw_node_info *info)
if ((str = spa_dict_lookup(info->props, PW_KEY_PRIORITY_SESSION)))
g->node.priority = atoi(str);
if ((str = spa_dict_lookup(info->props, PW_KEY_MEDIA_CLASS))) {
if (strcmp(str, "Audio/Sink") == 0)
if (spa_streq(str, "Audio/Sink"))
g->node.flags |= NODE_FLAG_SINK;
else if (strcmp(str, "Audio/Source") == 0)
else if (spa_streq(str, "Audio/Source"))
g->node.flags |= NODE_FLAG_SOURCE;
}
}
......@@ -991,7 +992,7 @@ static int json_object_find(const char *obj, const char *key, char *value, size_
return -EINVAL;
while (spa_json_get_string(&it[1], k, sizeof(k)-1) > 0) {
if (strcmp(k, key) == 0) {
if (spa_streq(k, key)) {
if (spa_json_get_string(&it[1], value, len) <= 0)
continue;
return 0;
......@@ -1013,14 +1014,14 @@ static int metadata_property(void *object,
snd_ctl_pipewire_t *ctl = g->ctl;
if (subject == PW_ID_CORE) {
if (key == NULL || strcmp(key, "default.audio.sink") == 0) {
if (key == NULL || spa_streq(key, "default.audio.sink")) {
if (value == NULL ||
json_object_find(value, "name",
ctl->default_sink, sizeof(ctl->default_sink)) < 0)
ctl->default_sink[0] = '\0';
pw_log_debug("found default sink: %s", ctl->default_sink);
}
if (key == NULL || strcmp(key, "default.audio.source") == 0) {
if (key == NULL || spa_streq(key, "default.audio.source")) {
if (value == NULL ||
json_object_find(value, "name",
ctl->default_source, sizeof(ctl->default_source)) < 0)
......@@ -1081,7 +1082,7 @@ static void registry_event_global(void *data, uint32_t id,
pw_log_debug("got %d %s", id, type);
if (strcmp(type, PW_TYPE_INTERFACE_Device) == 0) {
if (spa_streq(type, PW_TYPE_INTERFACE_Device)) {
if (props == NULL ||
((str = spa_dict_lookup(props, PW_KEY_MEDIA_CLASS)) == NULL) ||
(strcmp(str, "Audio/Device") != 0))
......@@ -1089,7 +1090,7 @@ static void registry_event_global(void *data, uint32_t id,
pw_log_debug("found device %d", id);
info = &device_info;
} else if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) {
} else if (spa_streq(type, PW_TYPE_INTERFACE_Node)) {
if (props == NULL ||
((str = spa_dict_lookup(props, PW_KEY_MEDIA_CLASS)) == NULL) ||
((strcmp(str, "Audio/Sink") != 0) &&
......@@ -1098,7 +1099,7 @@ static void registry_event_global(void *data, uint32_t id,
pw_log_debug("found node %d type:%s", id, str);
info = &node_info;
} else if (strcmp(type, PW_TYPE_INTERFACE_Metadata) == 0) {
} else if (spa_streq(type, PW_TYPE_INTERFACE_Metadata)) {
if (ctl->metadata != NULL)
return;
info = &metadata_info;
......@@ -1146,9 +1147,9 @@ static void registry_event_global_remove(void *data, uint32_t id)
if ((name = pw_properties_get(g->props, PW_KEY_NODE_NAME)) == NULL)
return;
if (strcmp(name, ctl->default_sink) == 0)
if (spa_streq(name, ctl->default_sink))
ctl->default_sink[0] = '\0';
if (strcmp(name, ctl->default_source) == 0)
if (spa_streq(name, ctl->default_source))
ctl->default_source[0] = '\0';
}
......@@ -1218,10 +1219,10 @@ SND_CTL_PLUGIN_DEFINE_FUNC(pipewire)
const char *id;
if (snd_config_get_id(n, &id) < 0)
continue;
if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0
|| strcmp(id, "hint") == 0)
if (spa_streq(id, "comment") || spa_streq(id, "type")
|| spa_streq(id, "hint"))
continue;
if (strcmp(id, "server") == 0) {
if (spa_streq(id, "server")) {
if (snd_config_get_string(n, &server) < 0) {
SNDERR("Invalid type for %s", id);
return -EINVAL;
......@@ -1230,7 +1231,7 @@ SND_CTL_PLUGIN_DEFINE_FUNC(pipewire)
}
continue;
}
if (strcmp(id, "device") == 0) {
if (spa_streq(id, "device")) {
if (snd_config_get_string(n, &device) < 0) {
SNDERR("Invalid type for %s", id);
return -EINVAL;
......@@ -1239,7 +1240,7 @@ SND_CTL_PLUGIN_DEFINE_FUNC(pipewire)
}
continue;
}
if (strcmp(id, "source") == 0) {
if (spa_streq(id, "source")) {
if (snd_config_get_string(n, &source) < 0) {
SNDERR("Invalid type for %s", id);
return -EINVAL;
......@@ -1248,7 +1249,7 @@ SND_CTL_PLUGIN_DEFINE_FUNC(pipewire)
}
continue;
}
if (strcmp(id, "sink") == 0) {
if (spa_streq(id, "sink")) {
if (snd_config_get_string(n, &sink) < 0) {
SNDERR("Invalid type for %s", id);
return -EINVAL;
......@@ -1257,7 +1258,7 @@ SND_CTL_PLUGIN_DEFINE_FUNC(pipewire)
}
continue;
}
if (strcmp(id, "fallback") == 0) {
if (spa_streq(id, "fallback")) {
if (snd_config_get_string(n, &fallback_name) < 0) {
SNDERR("Invalid value for %s", id);
return -EINVAL;
......
......@@ -41,6 +41,7 @@
#include <spa/debug/types.h>
#include <spa/param/props.h>
#include <spa/utils/result.h>
#include <spa/utils/string.h>
#include <pipewire/pipewire.h>
......@@ -1105,30 +1106,30 @@ SND_PCM_PLUGIN_DEFINE_FUNC(pipewire)
const char *id;
if (snd_config_get_id(n, &id) < 0)
continue;
if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0 || strcmp(id, "hint") == 0)
if (spa_streq(id, "comment") || spa_streq(id, "type") || spa_streq(id, "hint"))
continue;
if (strcmp(id, "name") == 0) {
if (spa_streq(id, "name")) {
snd_config_get_string(n, &node_name);
continue;
}
if (strcmp(id, "server") == 0) {
if (spa_streq(id, "server")) {
snd_config_get_string(n, &server_name);
continue;
}
if (strcmp(id, "playback_node") == 0) {
if (spa_streq(id, "playback_node")) {
snd_config_get_string(n, &playback_node);
continue;
}
if (strcmp(id, "capture_node") == 0) {
if (spa_streq(id, "capture_node")) {
snd_config_get_string(n, &capture_node);
continue;
}
if (strcmp(id, "exclusive") == 0) {
if (spa_streq(id, "exclusive")) {
if (snd_config_get_bool(n))
flags |= PW_STREAM_FLAG_EXCLUSIVE;
continue;
}
if (strcmp(id, "rate") == 0) {
if (spa_streq(id, "rate")) {
long val;
if (snd_config_get_integer(n, &val) == 0)
......@@ -1137,7 +1138,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(pipewire)
SNDERR("%s: invalid type", id);
continue;
}
if (strcmp(id, "format") == 0) {
if (spa_streq(id, "format")) {
const char *str;
if (snd_config_get_string(n, &str) == 0) {
......@@ -1149,7 +1150,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(pipewire)
}
continue;
}
if (strcmp(id, "channels") == 0) {
if (spa_streq(id, "channels")) {
long val;
if (snd_config_get_integer(n, &val) == 0)
......@@ -1158,7 +1159,7 @@ SND_PCM_PLUGIN_DEFINE_FUNC(pipewire)
SNDERR("%s: invalid type", id);
continue;
}
if (strcmp(id, "period_bytes") == 0) {
if (spa_streq(id, "period_bytes")) {
long val;
if (snd_config_get_integer(n, &val) == 0)
......
......@@ -30,6 +30,8 @@
#include <unistd.h>
#include <sys/mman.h>
#include <spa/utils/string.h>
#include <jack/metadata.h>
#include <jack/uuid.h>
......@@ -98,7 +100,7 @@ static jack_property_t *find_property(jack_description_t *desc, const char *key)
uint32_t i;
for (i = 0; i < desc->property_cnt; i++) {
jack_property_t *prop = &desc->properties[i];
if (strcmp(prop->key, key) == 0)
if (spa_streq(prop->key, key))
return prop;
}
return NULL;
......
......@@ -45,6 +45,7 @@
#include <spa/debug/types.h>
#include <spa/debug/pod.h>
#include <spa/utils/json.h>
#include <spa/utils/string.h>
#include <pipewire/pipewire.h>
#include <pipewire/private.h>
......@@ -568,8 +569,8 @@ static bool is_port_default(struct client *c, struct object *o)
return false;
if ((ot = o->port.node) != NULL &&
(strcmp(ot->node.node_name, c->metadata->default_audio_source) == 0 ||
strcmp(ot->node.node_name, c->metadata->default_audio_sink) == 0))
(spa_streq(ot->node.node_name, c->metadata->default_audio_source) ||
spa_streq(ot->node.node_name, c->metadata->default_audio_sink)))
return true;
return false;
......@@ -580,11 +581,11 @@ static struct object *find_port(struct client *c, const char *name)
struct object *o;
spa_list_for_each(o, &c->context.ports, link) {
if (strcmp(o->port.name, name) == 0 ||
strcmp(o->port.alias1, name) == 0 ||
strcmp(o->port.alias2, name) == 0)
if (spa_streq(o->port.name, name) ||
spa_streq(o->port.alias1, name) ||
spa_streq(o->port.alias2, name))
return o;
if (is_port_default(c, o) && strcmp(o->port.system, name) == 0)
if (is_port_default(c, o) && spa_streq(o->port.system, name))
return o;
}
return NULL;
......@@ -2082,7 +2083,7 @@ static int json_object_find(const char *obj, const char *key, char *value, size_
return -EINVAL;
while (spa_json_get_string(&it[1], k, sizeof(k)-1) > 0) {
if (strcmp(k, key) == 0) {
if (spa_streq(k, key)) {
if (spa_json_get_string(&it[1], value, len) <= 0)
continue;
return 0;
......@@ -2104,7 +2105,7 @@ static int metadata_property(void *object, uint32_t id,
pw_log_debug("set id:%u key:'%s' value:'%s' type:'%s'", id, key, value, type);
if (id == PW_ID_CORE) {
if (key == NULL || strcmp(key, "default.audio.sink") == 0) {
if (key == NULL || spa_streq(key, "default.audio.sink")) {
if (value != NULL) {
if (json_object_find(value, "name",
c->metadata->default_audio_sink,
......@@ -2114,7 +2115,7 @@ static int metadata_property(void *object, uint32_t id,
if (value == NULL)
c->metadata->default_audio_sink[0] = '\0';
}
if (key == NULL || strcmp(key, "default.audio.source") == 0) {
if (key == NULL || spa_streq(key, "default.audio.source")) {
if (value != NULL) {
if (json_object_find(value, "name",
c->metadata->default_audio_source,
......@@ -2177,7 +2178,7 @@ static void registry_event_global(void *data, uint32_t id,
if (props == NULL)
return;
if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) {
if (spa_streq(type, PW_TYPE_INTERFACE_Node)) {
const char *app, *node_name;
char tmp[JACK_CLIENT_NAME_SIZE+1];
......@@ -2238,7 +2239,7 @@ static void registry_event_global(void *data, uint32_t id,
spa_list_append(&c->context.nodes, &o->link);
pthread_mutex_unlock(&c->context.lock);
}
else if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0) {
else if (spa_streq(type, PW_TYPE_INTERFACE_Port)) {
const struct spa_dict_item *item;
unsigned long flags = 0;
jack_port_type_id_t type_id;
......@@ -2265,9 +2266,9 @@ static void registry_event_global(void *data, uint32_t id,
spa_dict_for_each(item, props) {
if (!strcmp(item->key, PW_KEY_PORT_DIRECTION)) {
if (strcmp(item->value, "in") == 0)
if (spa_streq(item->value, "in"))
flags |= JackPortIsInput;
else if (strcmp(item->value, "out") == 0)
else if (spa_streq(item->value, "out"))
flags |= JackPortIsOutput;
}
else if (!strcmp(item->key, PW_KEY_PORT_PHYSICAL)) {
......@@ -2348,7 +2349,7 @@ static void registry_event_global(void *data, uint32_t id,
pw_log_debug(NAME" %p: add port %d name:%s %d", c, id,
o->port.name, type_id);
}
else if (strcmp(type, PW_TYPE_INTERFACE_Link) == 0) {
else if (spa_streq(type, PW_TYPE_INTERFACE_Link)) {
o = alloc_object(c, INTERFACE_Link);
pthread_mutex_lock(&c->context.lock);
......@@ -2366,7 +2367,7 @@ static void registry_event_global(void *data, uint32_t id,
pw_log_debug(NAME" %p: add link %d %d->%d", c, id,
o->port_link.src, o->port_link.dst);
}
else if (strcmp(type, PW_TYPE_INTERFACE_Metadata) == 0) {
else if (spa_streq(type, PW_TYPE_INTERFACE_Metadata)) {
struct pw_proxy *proxy;
if (c->metadata)
......@@ -2454,9 +2455,9 @@ static void registry_event_global_remove(void *object, uint32_t id)
switch (o->type) {
case INTERFACE_Node:
if (c->metadata) {
if (strcmp(o->node.node_name, c->metadata->default_audio_sink) == 0)
if (spa_streq(o->node.node_name, c->metadata->default_audio_sink))
c->metadata->default_audio_sink[0] = '\0';
if (strcmp(o->node.node_name, c->metadata->default_audio_source) == 0)
if (spa_streq(o->node.node_name, c->metadata->default_audio_source))
c->metadata->default_audio_source[0] = '\0';
}
if (c->registration_callback && is_last)
......@@ -2537,7 +2538,7 @@ jack_client_t * jack_client_open (const char *client_name,
va_end(ap);
if (client->server_name != NULL &&
strcmp(client->server_name, "default") == 0)
spa_streq(client->server_name, "default"))
client->server_name = NULL;
client->props = pw_properties_new(
......@@ -2580,13 +2581,13 @@ jack_client_t * jack_client_open (const char *client_name,
client->self_connect_mode = SELF_CONNECT_ALLOW;
if ((str = pw_properties_get(client->props, "jack.self-connect-mode")) != NULL) {
if (strcmp(str, "fail-external") == 0)
if (spa_streq(str, "fail-external"))
client->self_connect_mode = SELF_CONNECT_FAIL_EXT;
else if (strcmp(str, "ignore-external") == 0)
else if (spa_streq(str, "ignore-external"))
client->self_connect_mode = SELF_CONNECT_IGNORE_EXT;
else if (strcmp(str, "fail-all") == 0)
else if (spa_streq(str, "fail-all"))
client->self_connect_mode = SELF_CONNECT_FAIL_ALL;
else if (strcmp(str, "ignore-all") == 0)
else if (spa_streq(str, "ignore-all"))
client->self_connect_mode = SELF_CONNECT_IGNORE_ALL;
}
......@@ -2811,7 +2812,7 @@ char *jack_get_uuid_for_client_name (jack_client_t *client,
pthread_mutex_lock(&c->context.lock);
spa_list_for_each(o, &c->context.nodes, link) {
if (strcmp(o->node.name, client_name) == 0) {
if (spa_streq(o->node.name, client_name)) {
uuid = spa_aprintf( "%" PRIu64, client_make_uuid(o->id));
pw_log_debug(NAME" %p: name %s -> %s",
client, client_name, uuid);
......@@ -3976,9 +3977,9 @@ int jack_port_unset_alias (jack_port_t *port, const char *alias)
pw_thread_loop_lock(c->context.loop);
if (strcmp(o->port.alias1, alias) == 0)
if (spa_streq(o->port.alias1, alias))
key = PW_KEY_OBJECT_PATH;
else if (strcmp(o->port.alias2, alias) == 0)
else if (spa_streq(o->port.alias2, alias))
key = PW_KEY_PORT_ALIAS;
else
goto error;
......@@ -4433,19 +4434,19 @@ static int port_compare_func(const void *v1, const void *v2)
ot1 = (*o1)->port.node;
if (is_cap1)
is_def1 = ot1 != NULL && strcmp(ot1->node.node_name,
c->metadata->default_audio_source) == 0;
is_def1 = ot1 != NULL && spa_streq(ot1->node.node_name,
c->metadata->default_audio_source);
else if (!is_cap1)
is_def1 = ot1 != NULL && strcmp(ot1->node.node_name,
c->metadata->default_audio_sink) == 0;
is_def1 = ot1 != NULL && spa_streq(ot1->node.node_name,
c->metadata->default_audio_sink);
ot2 = (*o2)->port.node;
if (is_cap2)
is_def2 = ot2 != NULL && strcmp(ot2->node.node_name,
c->metadata->default_audio_source) == 0;
is_def2 = ot2 != NULL && spa_streq(ot2->node.node_name,
c->metadata->default_audio_source);
else if (!is_cap2)
is_def2 = ot2 != NULL && strcmp(ot2->node.node_name,
c->metadata->default_audio_sink) == 0;
is_def2 = ot2 != NULL && spa_streq(ot2->node.node_name,
c->metadata->default_audio_sink);
}
if ((*o1)->port.type_id != (*o2)->port.type_id)
res = (*o1)->port.type_id - (*o2)->port.type_id;
......
......@@ -26,6 +26,8 @@
#include "alsa-mixer.h"
#include "alsa-ucm.h"
#include <spa/utils/string.h>
int _acp_log_level = 1;
acp_log_func _acp_log_func;
void *_acp_log_data;
......@@ -938,7 +940,7 @@ uint32_t acp_card_find_best_profile_index(struct acp_card *card, const char *nam
struct acp_card_profile *p = profiles[i];
if (name) {
if (strcmp(name, p->name) == 0)
if (spa_streq(name, p->name))
best = i;
} else if (p->flags & ACP_PROFILE_OFF) {
off = i;
......@@ -1442,7 +1444,7 @@ static const char *acp_dict_lookup(const struct acp_dict *dict, const char *key)
{
const struct acp_dict_item *it;
acp_dict_for_each(it, dict) {
if (strcmp(key, it->key) == 0)
if (spa_streq(key, it->key))
return it->value;
}
return NULL;
......@@ -1478,19 +1480,19 @@ struct acp_card *acp_card_new(uint32_t index, const struct acp_dict *props)
if (props) {
if ((s = acp_dict_lookup(props, "api.alsa.use-ucm")) != NULL)
impl->use_ucm = (strcmp(s, "true") == 0 || atoi(s) == 1);
impl->use_ucm = (spa_streq(s, "true") || atoi(s) == 1);
if ((s = acp_dict_lookup(props, "api.alsa.soft-mixer")) != NULL)
impl->soft_mixer = (strcmp(s, "true") == 0 || atoi(s) == 1);
impl->soft_mixer = (spa_streq(s, "true") || atoi(s) == 1);
if ((s = acp_dict_lookup(props, "api.alsa.ignore-dB")) != NULL)
ignore_dB = (strcmp(s, "true") == 0 || atoi(s) == 1);
ignore_dB = (spa_streq(s, "true") || atoi(s) == 1);
if ((s = acp_dict_lookup(props, "device.profile-set")) != NULL)
profile_set = s;
if ((s = acp_dict_lookup(props, "device.profile")) != NULL)
profile = s;
if ((s = acp_dict_lookup(props, "api.acp.auto-profile")) != NULL)
impl->auto_profile = (strcmp(s, "true") == 0 || atoi(s) == 1);
impl->auto_profile = (spa_streq(s, "true") || atoi(s) == 1);
if ((s = acp_dict_lookup(props, "api.acp.auto-port")) != NULL)
impl->auto_port = (strcmp(s, "true") == 0 || atoi(s) == 1);
impl->auto_port = (spa_streq(s, "true") || atoi(s) == 1);
}
impl->ucm.default_sample_spec.format = PA_SAMPLE_S16NE;
......@@ -1715,7 +1717,7 @@ uint32_t acp_device_find_best_port_index(struct acp_device *dev, const char *nam
struct acp_port *p = ports[i];
if (name) {
if (strcmp(name, p->name) == 0)
if (spa_streq(name, p->name))
best = i;
} else if (p->available == ACP_AVAILABLE_YES) {
if (best == ACP_INVALID_INDEX || p->priority > ports[best]->priority)
......
......@@ -36,6 +36,7 @@
#include <spa/node/node.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/support/loop.h>
#include <spa/support/plugin.h>
#include <spa/support/i18n.h>
......@@ -880,7 +881,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Device))
*interface = &this->device;
else
return -ENOENT;
......@@ -958,9 +959,9 @@ impl_init(const struct spa_handle_factory *factory,
if ((str = spa_dict_lookup(info, SPA_KEY_API_ALSA_PATH)) != NULL)
snprintf(this->props.device, sizeof(this->props.device), "%s", str);
if ((str = spa_dict_lookup(info, "api.acp.auto-port")) != NULL)
this->props.auto_port = strcmp(str, "true") == 0 || atoi(str) != 0;
this->props.auto_port = spa_streq(str, "true") || atoi(str) != 0;
if ((str = spa_dict_lookup(info, "api.acp.auto-profile")) != NULL)
this->props.auto_profile = strcmp(str, "true") == 0 || atoi(str) != 0;
this->props.auto_profile = spa_streq(str, "true") || atoi(str) != 0;
items = alloca((info->n_items) * sizeof(*items));
spa_dict_for_each(it, info)
......
......@@ -36,6 +36,7 @@
#include <spa/node/node.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/support/loop.h>
#include <spa/support/plugin.h>
#include <spa/monitor/device.h>
......@@ -492,7 +493,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Device))
*interface = &this->device;
else
return -ENOENT;
......
......@@ -32,6 +32,7 @@
#include <spa/monitor/device.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/param/audio/format.h>
#include <spa/pod/filter.h>
#include <spa/debug/pod.h>
......@@ -694,7 +695,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct state *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;
......@@ -807,11 +808,11 @@ impl_init(const struct spa_handle_factory *factory,
} else if (!strcmp(k, "api.alsa.start-delay")) {
this->default_start_delay = atoi(s);