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:
Peter Hutterer 2021-05-18 11:36:13 +10:00
parent d8a9534a9a
commit 7697ed0757
130 changed files with 817 additions and 675 deletions

View file

@ -28,6 +28,7 @@
#include "spa/pod/parser.h"
#include "spa/pod/builder.h"
#include "spa/debug/pod.h"
#include "spa/utils/string.h"
#include "pipewire/pipewire.h"
#include "pipewire/private.h"
@ -251,7 +252,7 @@ static int core_demarshal_permissions(void *object, const struct pw_protocol_nat
str = props.items[i].value;
/* first set global permissions */
if (strcmp(props.items[i].key, PW_CORE_PERMISSIONS_GLOBAL) == 0) {
if (spa_streq(props.items[i].key, PW_CORE_PERMISSIONS_GLOBAL)) {
size_t len;
/* <global-id>:[r][w][x] */
@ -261,7 +262,7 @@ static int core_demarshal_permissions(void *object, const struct pw_protocol_nat
id = atoi(str);
perms = parse_perms(str + len);
permissions[n_permissions++] = PW_PERMISSION_INIT(id, perms);
} else if (strcmp(props.items[i].key, PW_CORE_PERMISSIONS_DEFAULT) == 0) {
} else if (spa_streq(props.items[i].key, PW_CORE_PERMISSIONS_DEFAULT)) {
perms = parse_perms(str);
defperm = PW_PERMISSION_INIT(PW_ID_ANY, perms);
}
@ -815,15 +816,15 @@ static void registry_marshal_global(void *object, uint32_t id, uint32_t permissi
parent_id = 0;
if (props) {
if (strcmp(type, PW_TYPE_INTERFACE_Port) == 0) {
if (spa_streq(type, PW_TYPE_INTERFACE_Port)) {
if ((str = spa_dict_lookup(props, "node.id")) != NULL)
parent_id = atoi(str);
} else if (strcmp(type, PW_TYPE_INTERFACE_Node) == 0) {
} else if (spa_streq(type, PW_TYPE_INTERFACE_Node)) {
if ((str = spa_dict_lookup(props, "device.id")) != NULL)
parent_id = atoi(str);
} else if (strcmp(type, PW_TYPE_INTERFACE_Client) == 0 ||
strcmp(type, PW_TYPE_INTERFACE_Device) == 0 ||
strcmp(type, PW_TYPE_INTERFACE_Factory) == 0) {
} else if (spa_streq(type, PW_TYPE_INTERFACE_Client) ||
spa_streq(type, PW_TYPE_INTERFACE_Device) ||
spa_streq(type, PW_TYPE_INTERFACE_Factory)) {
if ((str = spa_dict_lookup(props, "module.id")) != NULL)
parent_id = atoi(str);
}