mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
treewide: drop strzcmp implementations in favor of spa_streq
This commit is contained in:
parent
92514d57e4
commit
4e70799922
4 changed files with 9 additions and 45 deletions
|
|
@ -139,24 +139,15 @@ static void remove_property(jack_description_t *desc, jack_property_t *prop)
|
|||
remove_description(desc);
|
||||
}
|
||||
|
||||
static inline int strzcmp(const char *s1, const char *s2)
|
||||
{
|
||||
if (s1 == s2)
|
||||
return 0;
|
||||
if (s1 == NULL || s2 == NULL)
|
||||
return 1;
|
||||
return strcmp(s1, s2);
|
||||
}
|
||||
|
||||
static int change_property(jack_property_t *prop, const char *value, const char *type)
|
||||
{
|
||||
int changed = 0;
|
||||
if (strzcmp(prop->data, value) != 0) {
|
||||
if (!spa_streq(prop->data, value)) {
|
||||
free((char*)prop->data);
|
||||
prop->data = strdup(value);
|
||||
changed++;
|
||||
}
|
||||
if (strzcmp(prop->type, type) != 0) {
|
||||
if (!spa_streq(prop->type, type)) {
|
||||
free((char*)prop->type);
|
||||
prop->type = strdup(type);
|
||||
changed++;
|
||||
|
|
|
|||
|
|
@ -62,24 +62,15 @@ static void set_item(struct item *item, uint32_t subject, const char *key, const
|
|||
item->value = strdup(value);
|
||||
}
|
||||
|
||||
static inline int strzcmp(const char *s1, const char *s2)
|
||||
{
|
||||
if (s1 == s2)
|
||||
return 0;
|
||||
if (s1 == NULL || s2 == NULL)
|
||||
return 1;
|
||||
return strcmp(s1, s2);
|
||||
}
|
||||
|
||||
static int change_item(struct item *item, const char *type, const char *value)
|
||||
{
|
||||
int changed = 0;
|
||||
if (strzcmp(item->type, type) != 0) {
|
||||
if (!spa_streq(item->type, type)) {
|
||||
free((char*)item->type);
|
||||
item->type = type ? strdup(type) : NULL;
|
||||
changed++;
|
||||
}
|
||||
if (strzcmp(item->value, value) != 0) {
|
||||
if (!spa_streq(item->value, value)) {
|
||||
free((char*)item->value);
|
||||
item->value = value ? strdup(value) : NULL;
|
||||
changed++;
|
||||
|
|
|
|||
|
|
@ -393,15 +393,6 @@ static void destroy_node(struct impl *impl, struct node *node)
|
|||
sm_object_remove_data((struct sm_object*)node->obj, SESSION_KEY);
|
||||
}
|
||||
|
||||
static inline int strzcmp(const char *s1, const char *s2)
|
||||
{
|
||||
if (s1 == s2)
|
||||
return 0;
|
||||
if (s1 == NULL || s2 == NULL)
|
||||
return 1;
|
||||
return strcmp(s1, s2);
|
||||
}
|
||||
|
||||
static int json_object_find(const char *obj, const char *key, char *value, size_t len)
|
||||
{
|
||||
struct spa_json it[2];
|
||||
|
|
@ -931,7 +922,7 @@ static void refresh_auto_default_nodes(struct impl *impl)
|
|||
const char *name = pw_properties_get(node->obj->obj.props, PW_KEY_NODE_NAME);
|
||||
char buf[1024];
|
||||
|
||||
if (name == NULL || strzcmp(name, def->value) == 0)
|
||||
if (name == NULL || spa_streq(name, def->value))
|
||||
continue;
|
||||
|
||||
free(def->value);
|
||||
|
|
@ -1063,13 +1054,13 @@ static int metadata_property(void *object, uint32_t subject,
|
|||
}
|
||||
for (def = impl->defaults; def->key != NULL; ++def) {
|
||||
if (key == NULL || spa_streq(key, def->key_config)) {
|
||||
if (strzcmp(def->config, val) != 0)
|
||||
if (!spa_streq(def->config, val))
|
||||
changed = true;
|
||||
free(def->config);
|
||||
def->config = val ? strdup(val) : NULL;
|
||||
}
|
||||
if (key == NULL || spa_streq(key, def->key)) {
|
||||
bool eff_changed = strzcmp(def->value, val) != 0;
|
||||
bool eff_changed = !spa_streq(def->value, val);
|
||||
free(def->value);
|
||||
def->value = val ? strdup(val) : NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -805,15 +805,6 @@ static int json_object_find(const char *obj, const char *key, char *value, size_
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
static inline int strzcmp(const char *s1, const char *s2)
|
||||
{
|
||||
if (s1 == s2)
|
||||
return 0;
|
||||
if (s1 == NULL || s2 == NULL)
|
||||
return 1;
|
||||
return strcmp(s1, s2);
|
||||
}
|
||||
|
||||
static void manager_metadata(void *data, struct pw_manager_object *o,
|
||||
uint32_t subject, const char *key, const char *type, const char *value)
|
||||
{
|
||||
|
|
@ -834,7 +825,7 @@ static void manager_metadata(void *data, struct pw_manager_object *o,
|
|||
else
|
||||
value = name;
|
||||
}
|
||||
if ((changed = strzcmp(client->default_sink, value))) {
|
||||
if ((changed = !spa_streq(client->default_sink, value))) {
|
||||
free(client->default_sink);
|
||||
client->default_sink = value ? strdup(value) : NULL;
|
||||
}
|
||||
|
|
@ -847,7 +838,7 @@ static void manager_metadata(void *data, struct pw_manager_object *o,
|
|||
else
|
||||
value = name;
|
||||
}
|
||||
if ((changed = strzcmp(client->default_source, value))) {
|
||||
if ((changed = !spa_streq(client->default_source, value))) {
|
||||
free(client->default_source);
|
||||
client->default_source = value ? strdup(value) : NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue