mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
treewide: replace !strcmp() 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
7697ed0757
commit
95a84e797a
28 changed files with 239 additions and 221 deletions
|
|
@ -31,6 +31,8 @@
|
|||
#include <stdbool.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
#include <acp/acp.h>
|
||||
|
||||
#define WHITESPACE "\n\r\t "
|
||||
|
|
@ -277,7 +279,7 @@ static int cmd_list(struct data *data, const struct command *cmd, int argc, char
|
|||
uint32_t i;
|
||||
int level = 0;
|
||||
|
||||
if (!strcmp(cmd->name, "list-verbose"))
|
||||
if (spa_streq(cmd->name, "list-verbose"))
|
||||
level = 2;
|
||||
|
||||
print_card(data, card, 0, level);
|
||||
|
|
@ -530,8 +532,8 @@ static const struct command *find_command(struct data *data, const char *cmd)
|
|||
{
|
||||
size_t i;
|
||||
for (i = 0; i < N_COMMANDS; i++) {
|
||||
if (!strcmp(command_list[i].name, cmd) ||
|
||||
!strcmp(command_list[i].alias, cmd))
|
||||
if (spa_streq(command_list[i].name, cmd) ||
|
||||
spa_streq(command_list[i].alias, cmd))
|
||||
return &command_list[i];
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -791,27 +791,27 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
for (i = 0; info && i < info->n_items; i++) {
|
||||
const char *k = info->items[i].key;
|
||||
const char *s = info->items[i].value;
|
||||
if (!strcmp(k, SPA_KEY_API_ALSA_PATH)) {
|
||||
if (spa_streq(k, SPA_KEY_API_ALSA_PATH)) {
|
||||
snprintf(this->props.device, 63, "%s", s);
|
||||
} else if (!strcmp(k, SPA_KEY_AUDIO_CHANNELS)) {
|
||||
} else if (spa_streq(k, SPA_KEY_AUDIO_CHANNELS)) {
|
||||
this->default_channels = atoi(s);
|
||||
} else if (!strcmp(k, SPA_KEY_AUDIO_RATE)) {
|
||||
} else if (spa_streq(k, SPA_KEY_AUDIO_RATE)) {
|
||||
this->default_rate = atoi(s);
|
||||
} else if (!strcmp(k, SPA_KEY_AUDIO_FORMAT)) {
|
||||
} else if (spa_streq(k, SPA_KEY_AUDIO_FORMAT)) {
|
||||
this->default_format = spa_alsa_format_from_name(s, strlen(s));
|
||||
} else if (!strcmp(k, SPA_KEY_AUDIO_POSITION)) {
|
||||
} else if (spa_streq(k, SPA_KEY_AUDIO_POSITION)) {
|
||||
spa_alsa_parse_position(&this->default_pos, s, strlen(s));
|
||||
} else if (!strcmp(k, "api.alsa.period-size")) {
|
||||
} else if (spa_streq(k, "api.alsa.period-size")) {
|
||||
this->default_period_size = atoi(s);
|
||||
} else if (!strcmp(k, "api.alsa.headroom")) {
|
||||
} else if (spa_streq(k, "api.alsa.headroom")) {
|
||||
this->default_headroom = atoi(s);
|
||||
} else if (!strcmp(k, "api.alsa.start-delay")) {
|
||||
} else if (spa_streq(k, "api.alsa.start-delay")) {
|
||||
this->default_start_delay = atoi(s);
|
||||
} else if (!strcmp(k, "api.alsa.disable-mmap")) {
|
||||
} else if (spa_streq(k, "api.alsa.disable-mmap")) {
|
||||
this->disable_mmap = (spa_streq(s, "true") || atoi(s) == 1);
|
||||
} else if (!strcmp(k, "api.alsa.disable-batch")) {
|
||||
} else if (spa_streq(k, "api.alsa.disable-batch")) {
|
||||
this->disable_batch = (spa_streq(s, "true") || atoi(s) == 1);
|
||||
} else if (!strcmp(k, "api.alsa.use-chmap")) {
|
||||
} else if (spa_streq(k, "api.alsa.use-chmap")) {
|
||||
this->props.use_chmap = (spa_streq(s, "true") || atoi(s) == 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -811,25 +811,25 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
for (i = 0; info && i < info->n_items; i++) {
|
||||
const char *k = info->items[i].key;
|
||||
const char *s = info->items[i].value;
|
||||
if (!strcmp(k, SPA_KEY_API_ALSA_PATH)) {
|
||||
if (spa_streq(k, SPA_KEY_API_ALSA_PATH)) {
|
||||
snprintf(this->props.device, 63, "%s", s);
|
||||
} else if (!strcmp(k, SPA_KEY_AUDIO_CHANNELS)) {
|
||||
} else if (spa_streq(k, SPA_KEY_AUDIO_CHANNELS)) {
|
||||
this->default_channels = atoi(s);
|
||||
} else if (!strcmp(k, SPA_KEY_AUDIO_RATE)) {
|
||||
} else if (spa_streq(k, SPA_KEY_AUDIO_RATE)) {
|
||||
this->default_rate = atoi(s);
|
||||
} else if (!strcmp(k, SPA_KEY_AUDIO_FORMAT)) {
|
||||
} else if (spa_streq(k, SPA_KEY_AUDIO_FORMAT)) {
|
||||
this->default_format = spa_alsa_format_from_name(s, strlen(s));
|
||||
} else if (!strcmp(k, SPA_KEY_AUDIO_POSITION)) {
|
||||
} else if (spa_streq(k, SPA_KEY_AUDIO_POSITION)) {
|
||||
spa_alsa_parse_position(&this->default_pos, s, strlen(s));
|
||||
} else if (!strcmp(k, "api.alsa.period-size")) {
|
||||
} else if (spa_streq(k, "api.alsa.period-size")) {
|
||||
this->default_period_size = atoi(s);
|
||||
} else if (!strcmp(k, "api.alsa.headroom")) {
|
||||
} else if (spa_streq(k, "api.alsa.headroom")) {
|
||||
this->default_headroom = atoi(s);
|
||||
} else if (!strcmp(k, "api.alsa.disable-mmap")) {
|
||||
} else if (spa_streq(k, "api.alsa.disable-mmap")) {
|
||||
this->disable_mmap = (spa_streq(s, "true") || atoi(s) == 1);
|
||||
} else if (!strcmp(k, "api.alsa.disable-batch")) {
|
||||
} else if (spa_streq(k, "api.alsa.disable-batch")) {
|
||||
this->disable_batch = (spa_streq(s, "true") || atoi(s) == 1);
|
||||
} else if (!strcmp(k, "api.alsa.use-chmap")) {
|
||||
} else if (spa_streq(k, "api.alsa.use-chmap")) {
|
||||
this->props.use_chmap = (spa_streq(s, "true") || atoi(s) == 1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -878,7 +878,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
reset_props(&this->props);
|
||||
|
||||
for (i = 0; info && i < info->n_items; i++) {
|
||||
if (!strcmp(info->items[i].key, SPA_KEY_API_ALSA_PATH)) {
|
||||
if (spa_streq(info->items[i].key, SPA_KEY_API_ALSA_PATH)) {
|
||||
snprintf(this->props.device, 63, "%s", info->items[i].value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue