mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -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
|
|
@ -40,6 +40,7 @@
|
|||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/hook.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
#define NAME "cpu"
|
||||
|
||||
|
|
@ -205,7 +206,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_CPU) == 0)
|
||||
if (spa_streq(type, SPA_TYPE_INTERFACE_CPU))
|
||||
*interface = &this->cpu;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include <spa/utils/result.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/utils/string.h>
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/support/plugin.h>
|
||||
#include <spa/support/dbus.h>
|
||||
|
|
@ -437,7 +438,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_DBus) == 0)
|
||||
if (spa_streq(type, SPA_TYPE_INTERFACE_DBus))
|
||||
*interface = &this->dbus;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include <spa/support/plugin.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/result.h>
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
#define NAME "evl-system"
|
||||
|
||||
|
|
@ -372,7 +373,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
|
|||
|
||||
impl = (struct impl *) handle;
|
||||
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_System) == 0)
|
||||
if (spa_streq(type, SPA_TYPE_INTERFACE_System))
|
||||
*interface = &impl->system;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include <spa/support/plugin.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
#include <systemd/sd-journal.h>
|
||||
|
||||
|
|
@ -135,7 +136,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Log) == 0)
|
||||
if (spa_streq(type, SPA_TYPE_INTERFACE_Log))
|
||||
*interface = &this->log;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include <spa/utils/ringbuffer.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
|
||||
|
|
@ -190,7 +191,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Log) == 0)
|
||||
if (spa_streq(type, SPA_TYPE_INTERFACE_Log))
|
||||
*interface = &this->log;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -265,11 +266,11 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
}
|
||||
if (info) {
|
||||
if ((str = spa_dict_lookup(info, SPA_KEY_LOG_TIMESTAMP)) != NULL)
|
||||
this->timestamp = (strcmp(str, "true") == 0 || atoi(str) == 1);
|
||||
this->timestamp = (spa_streq(str, "true") || atoi(str) == 1);
|
||||
if ((str = spa_dict_lookup(info, SPA_KEY_LOG_LINE)) != NULL)
|
||||
this->line = (strcmp(str, "true") == 0 || atoi(str) == 1);
|
||||
this->line = (spa_streq(str, "true") || atoi(str) == 1);
|
||||
if ((str = spa_dict_lookup(info, SPA_KEY_LOG_COLORS)) != NULL)
|
||||
this->colors = (strcmp(str, "true") == 0 || atoi(str) == 1);
|
||||
this->colors = (spa_streq(str, "true") || atoi(str) == 1);
|
||||
if ((str = spa_dict_lookup(info, SPA_KEY_LOG_LEVEL)) != NULL)
|
||||
this->log.level = atoi(str);
|
||||
if ((str = spa_dict_lookup(info, SPA_KEY_LOG_FILE)) != NULL) {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include <spa/utils/result.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/ringbuffer.h>
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
#define NAME "loop"
|
||||
|
||||
|
|
@ -706,11 +707,11 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
|
|||
|
||||
impl = (struct impl *) handle;
|
||||
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Loop) == 0)
|
||||
if (spa_streq(type, SPA_TYPE_INTERFACE_Loop))
|
||||
*interface = &impl->loop;
|
||||
else if (strcmp(type, SPA_TYPE_INTERFACE_LoopControl) == 0)
|
||||
else if (spa_streq(type, SPA_TYPE_INTERFACE_LoopControl))
|
||||
*interface = &impl->control;
|
||||
else if (strcmp(type, SPA_TYPE_INTERFACE_LoopUtils) == 0)
|
||||
else if (spa_streq(type, SPA_TYPE_INTERFACE_LoopUtils))
|
||||
*interface = &impl->utils;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include <spa/support/log.h>
|
||||
#include <spa/support/loop.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/utils/string.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/node/keys.h>
|
||||
#include <spa/node/io.h>
|
||||
|
|
@ -267,7 +268,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -359,7 +360,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
if (info) {
|
||||
if ((str = spa_dict_lookup(info, "node.freewheel")) != NULL)
|
||||
this->props.freewheel = (strcmp(str, "true") == 0 || atoi(str) == 1);
|
||||
this->props.freewheel = (spa_streq(str, "true") || atoi(str) == 1);
|
||||
}
|
||||
|
||||
spa_loop_add_source(this->data_loop, &this->timer_source);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/json.h>
|
||||
#include <spa/utils/string.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/node/utils.h>
|
||||
#include <spa/node/io.h>
|
||||
|
|
@ -695,7 +696,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
|
|||
|
||||
this = (struct impl *) handle;
|
||||
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
|
||||
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
|
||||
*interface = &this->node;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
@ -728,7 +729,7 @@ static uint32_t channel_from_name(const char *name)
|
|||
{
|
||||
int i;
|
||||
for (i = 0; spa_type_audio_channel[i].name; i++) {
|
||||
if (strcmp(name, spa_debug_type_short_name(spa_type_audio_channel[i].name)) == 0)
|
||||
if (spa_streq(name, spa_debug_type_short_name(spa_type_audio_channel[i].name)))
|
||||
return spa_type_audio_channel[i].type;
|
||||
}
|
||||
return SPA_AUDIO_CHANNEL_UNKNOWN;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include <spa/support/plugin.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/names.h>
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
#define NAME "system"
|
||||
|
||||
|
|
@ -301,7 +302,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
|
|||
|
||||
impl = (struct impl *) handle;
|
||||
|
||||
if (strcmp(type, SPA_TYPE_INTERFACE_System) == 0)
|
||||
if (spa_streq(type, SPA_TYPE_INTERFACE_System))
|
||||
*interface = &impl->system;
|
||||
else
|
||||
return -ENOENT;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue