treewide: replace plain strcmp() calls with spa_streq

This commit is contained in:
Peter Hutterer 2021-05-18 13:49:02 +10:00
parent 522f87d5ea
commit 92514d57e4
7 changed files with 17 additions and 13 deletions

View file

@ -48,6 +48,7 @@
#include <spa/param/audio/format-utils.h> #include <spa/param/audio/format-utils.h>
#include <spa/utils/names.h> #include <spa/utils/names.h>
#include <spa/utils/result.h> #include <spa/utils/result.h>
#include <spa/utils/string.h>
static SPA_LOG_IMPL(default_log); static SPA_LOG_IMPL(default_log);
@ -127,7 +128,7 @@ static int load_handle(struct data *data, struct spa_handle **handle, const char
} }
if (factory->version < 1) if (factory->version < 1)
continue; continue;
if (strcmp(factory->name, name)) if (!spa_streq(factory->name, name))
continue; continue;
*handle = calloc(1, spa_handle_factory_get_size(factory, NULL)); *handle = calloc(1, spa_handle_factory_get_size(factory, NULL));
@ -239,7 +240,7 @@ static int make_node(struct data *data, struct spa_node **node, const char *lib,
} }
if (factory->version < 1) if (factory->version < 1)
continue; continue;
if (strcmp(factory->name, name)) if (!spa_streq(factory->name, name))
continue; continue;
handle = calloc(1, spa_handle_factory_get_size(factory, NULL)); handle = calloc(1, spa_handle_factory_get_size(factory, NULL));

View file

@ -45,6 +45,7 @@
#include <spa/param/audio/format-utils.h> #include <spa/param/audio/format-utils.h>
#include <spa/utils/names.h> #include <spa/utils/names.h>
#include <spa/utils/result.h> #include <spa/utils/result.h>
#include <spa/utils/string.h>
#define M_PI_M2 ( M_PI + M_PI ) #define M_PI_M2 ( M_PI + M_PI )
@ -171,7 +172,7 @@ static int make_node(struct data *data, struct spa_node **node, const char *lib,
} }
if (factory->version < 1) if (factory->version < 1)
continue; continue;
if (strcmp(factory->name, name)) if (!spa_streq(factory->name, name))
continue; continue;
handle = calloc(1, spa_handle_factory_get_size(factory, NULL)); handle = calloc(1, spa_handle_factory_get_size(factory, NULL));
@ -456,7 +457,7 @@ static int load_handle(struct data *data, struct spa_handle **handle, const char
} }
if (factory->version < 1) if (factory->version < 1)
continue; continue;
if (strcmp(factory->name, name)) if (!spa_streq(factory->name, name))
continue; continue;
*handle = calloc(1, spa_handle_factory_get_size(factory, NULL)); *handle = calloc(1, spa_handle_factory_get_size(factory, NULL));

View file

@ -42,6 +42,7 @@
#include <spa/support/plugin.h> #include <spa/support/plugin.h>
#include <spa/utils/names.h> #include <spa/utils/names.h>
#include <spa/utils/result.h> #include <spa/utils/result.h>
#include <spa/utils/string.h>
#include <spa/support/log-impl.h> #include <spa/support/log-impl.h>
#include <spa/support/loop.h> #include <spa/support/loop.h>
#include <spa/node/node.h> #include <spa/node/node.h>
@ -129,7 +130,7 @@ static int load_handle(struct data *data, struct spa_handle **handle, const char
printf("can't enumerate factories: %s\n", spa_strerror(res)); printf("can't enumerate factories: %s\n", spa_strerror(res));
break; break;
} }
if (strcmp(factory->name, name)) if (!spa_streq(factory->name, name))
continue; continue;
*handle = calloc(1, spa_handle_factory_get_size(factory, NULL)); *handle = calloc(1, spa_handle_factory_get_size(factory, NULL));

View file

@ -39,6 +39,7 @@
#include <spa/support/plugin.h> #include <spa/support/plugin.h>
#include <spa/utils/names.h> #include <spa/utils/names.h>
#include <spa/utils/result.h> #include <spa/utils/result.h>
#include <spa/utils/string.h>
#include <spa/support/log-impl.h> #include <spa/support/log-impl.h>
#include <spa/support/loop.h> #include <spa/support/loop.h>
#include <spa/node/node.h> #include <spa/node/node.h>
@ -122,7 +123,7 @@ static int load_handle(struct data *data, struct spa_handle **handle, const char
} }
if (factory->version < 1) if (factory->version < 1)
continue; continue;
if (strcmp(factory->name, name)) if (!spa_streq(factory->name, name))
continue; continue;
*handle = calloc(1, spa_handle_factory_get_size(factory, NULL)); *handle = calloc(1, spa_handle_factory_get_size(factory, NULL));

View file

@ -514,11 +514,11 @@ static struct spa_bt_adapter *adapter_find(struct spa_bt_monitor *monitor, const
static bool check_iter_signature(DBusMessageIter *it, const char *sig) static bool check_iter_signature(DBusMessageIter *it, const char *sig)
{ {
char *v; char *v;
int res; bool res;
v = dbus_message_iter_get_signature(it); v = dbus_message_iter_get_signature(it);
res = strcmp(v, sig); res = spa_streq(v, sig);
dbus_free(v); dbus_free(v);
return res == 0; return res;
} }
static int adapter_update_props(struct spa_bt_adapter *adapter, static int adapter_update_props(struct spa_bt_adapter *adapter,

View file

@ -395,11 +395,11 @@ static struct node *alsa_create_node(struct device *device, uint32_t id,
pw_properties_set(node->props, PW_KEY_NODE_DESCRIPTION, pw_properties_set(node->props, PW_KEY_NODE_DESCRIPTION,
sm_media_session_sanitize_description(tmp, sizeof(tmp), sm_media_session_sanitize_description(tmp, sizeof(tmp),
' ', "%s %s", desc, profile_desc)); ' ', "%s %s", desc, profile_desc));
} else if (strcmp(subdev, "0")) { } else if (!spa_streq(subdev, "0")) {
pw_properties_set(node->props, PW_KEY_NODE_DESCRIPTION, pw_properties_set(node->props, PW_KEY_NODE_DESCRIPTION,
sm_media_session_sanitize_description(tmp, sizeof(tmp), sm_media_session_sanitize_description(tmp, sizeof(tmp),
' ', "%s (%s %s)", desc, name, subdev)); ' ', "%s (%s %s)", desc, name, subdev));
} else if (strcmp(dev, "0")) { } else if (!spa_streq(dev, "0")) {
pw_properties_set(node->props, PW_KEY_NODE_DESCRIPTION, pw_properties_set(node->props, PW_KEY_NODE_DESCRIPTION,
sm_media_session_sanitize_description(tmp, sizeof(tmp), sm_media_session_sanitize_description(tmp, sizeof(tmp),
' ', "%s (%s)", desc, name)); ' ', "%s (%s)", desc, name));

View file

@ -1968,7 +1968,7 @@ children_of(struct remote_data *rd, uint32_t parent_id,
global = item->data; global = item->data;
if (strcmp(global->type, child_type)) if (!spa_streq(global->type, child_type))
continue; continue;
pd = pw_proxy_get_user_data(global->proxy); pd = pw_proxy_get_user_data(global->proxy);
@ -1983,7 +1983,7 @@ children_of(struct remote_data *rd, uint32_t parent_id,
} }
/* match? */ /* match? */
if (strcmp(parent_value, child_value)) if (!spa_streq(parent_value, child_value))
continue; continue;
if (*children) if (*children)