mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
pulsecore: Use pa_streq instead of strcmp.
This commit is contained in:
parent
e5954aca8e
commit
96a52257a9
8 changed files with 27 additions and 22 deletions
|
|
@ -168,7 +168,7 @@ char *pa_win32_get_toplevel(HANDLE handle) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
p = strrchr(toplevel, PA_PATH_SEP_CHAR);
|
p = strrchr(toplevel, PA_PATH_SEP_CHAR);
|
||||||
if (p && (strcmp(p + 1, "bin") == 0))
|
if (p && pa_streq(p + 1, "bin"))
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -892,9 +892,9 @@ int pa_parse_boolean(const char *v) {
|
||||||
pa_assert(v);
|
pa_assert(v);
|
||||||
|
|
||||||
/* First we check language independent */
|
/* First we check language independent */
|
||||||
if (!strcmp(v, "1") || v[0] == 'y' || v[0] == 'Y' || v[0] == 't' || v[0] == 'T' || !strcasecmp(v, "on"))
|
if (pa_streq(v, "1") || v[0] == 'y' || v[0] == 'Y' || v[0] == 't' || v[0] == 'T' || !strcasecmp(v, "on"))
|
||||||
return 1;
|
return 1;
|
||||||
else if (!strcmp(v, "0") || v[0] == 'n' || v[0] == 'N' || v[0] == 'f' || v[0] == 'F' || !strcasecmp(v, "off"))
|
else if (pa_streq(v, "0") || v[0] == 'n' || v[0] == 'N' || v[0] == 'f' || v[0] == 'F' || !strcasecmp(v, "off"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef HAVE_LANGINFO_H
|
#ifdef HAVE_LANGINFO_H
|
||||||
|
|
@ -1100,7 +1100,7 @@ static int is_group(gid_t gid, const char *name) {
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = strcmp(name, group->gr_name) == 0;
|
r = pa_streq(name, group->gr_name);
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
pa_getgrgid_free(group);
|
pa_getgrgid_free(group);
|
||||||
|
|
@ -1998,7 +1998,7 @@ pa_bool_t pa_endswith(const char *s, const char *sfx) {
|
||||||
l1 = strlen(s);
|
l1 = strlen(s);
|
||||||
l2 = strlen(sfx);
|
l2 = strlen(sfx);
|
||||||
|
|
||||||
return l1 >= l2 && strcmp(s+l1-l2, sfx) == 0;
|
return l1 >= l2 && pa_streq(s + l1 - l2, sfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_bool_t pa_is_path_absolute(const char *fn) {
|
pa_bool_t pa_is_path_absolute(const char *fn) {
|
||||||
|
|
|
||||||
|
|
@ -110,13 +110,13 @@ pa_bool_t pa_cpu_init_arm(pa_cpu_arm_flag_t *flags) {
|
||||||
char *current;
|
char *current;
|
||||||
|
|
||||||
while ((current = pa_split_spaces(line, &state))) {
|
while ((current = pa_split_spaces(line, &state))) {
|
||||||
if (!strcmp(current, "vfp"))
|
if (pa_streq(current, "vfp"))
|
||||||
*flags |= PA_CPU_ARM_VFP;
|
*flags |= PA_CPU_ARM_VFP;
|
||||||
else if (!strcmp(current, "edsp"))
|
else if (pa_streq(current, "edsp"))
|
||||||
*flags |= PA_CPU_ARM_EDSP;
|
*flags |= PA_CPU_ARM_EDSP;
|
||||||
else if (!strcmp(current, "neon"))
|
else if (pa_streq(current, "neon"))
|
||||||
*flags |= PA_CPU_ARM_NEON;
|
*flags |= PA_CPU_ARM_NEON;
|
||||||
else if (!strcmp(current, "vfpv3"))
|
else if (pa_streq(current, "vfpv3"))
|
||||||
*flags |= PA_CPU_ARM_VFPV3;
|
*flags |= PA_CPU_ARM_VFPV3;
|
||||||
|
|
||||||
pa_xfree(current);
|
pa_xfree(current);
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ static int add_key_value(pa_modargs *ma, char *key, char *value, const char* con
|
||||||
if (valid_keys) {
|
if (valid_keys) {
|
||||||
const char*const* v;
|
const char*const* v;
|
||||||
for (v = valid_keys; *v; v++)
|
for (v = valid_keys; *v; v++)
|
||||||
if (strcmp(*v, key) == 0)
|
if (pa_streq(*v, key))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!*v) {
|
if (!*v) {
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
|
||||||
/* OK, the module only wants to be loaded once, let's make sure it is */
|
/* OK, the module only wants to be loaded once, let's make sure it is */
|
||||||
|
|
||||||
PA_IDXSET_FOREACH(i, c->modules, idx) {
|
PA_IDXSET_FOREACH(i, c->modules, idx) {
|
||||||
if (strcmp(name, i->name) == 0) {
|
if (pa_streq(name, i->name)) {
|
||||||
pa_log("Module \"%s\" should be loaded once at most. Refusing to load.", name);
|
pa_log("Module \"%s\" should be loaded once at most. Refusing to load.", name);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
#include <pulsecore/macro.h>
|
#include <pulsecore/macro.h>
|
||||||
#include <pulsecore/strbuf.h>
|
#include <pulsecore/strbuf.h>
|
||||||
#include <pulsecore/remap.h>
|
#include <pulsecore/remap.h>
|
||||||
|
#include <pulsecore/core-util.h>
|
||||||
#include "ffmpeg/avcodec.h"
|
#include "ffmpeg/avcodec.h"
|
||||||
|
|
||||||
#include "resampler.h"
|
#include "resampler.h"
|
||||||
|
|
@ -545,13 +545,13 @@ pa_resample_method_t pa_parse_resample_method(const char *string) {
|
||||||
pa_assert(string);
|
pa_assert(string);
|
||||||
|
|
||||||
for (m = 0; m < PA_RESAMPLER_MAX; m++)
|
for (m = 0; m < PA_RESAMPLER_MAX; m++)
|
||||||
if (!strcmp(string, resample_methods[m]))
|
if (pa_streq(string, resample_methods[m]))
|
||||||
return m;
|
return m;
|
||||||
|
|
||||||
if (!strcmp(string, "speex-fixed"))
|
if (pa_streq(string, "speex-fixed"))
|
||||||
return PA_RESAMPLER_SPEEX_FIXED_BASE + 3;
|
return PA_RESAMPLER_SPEEX_FIXED_BASE + 3;
|
||||||
|
|
||||||
if (!strcmp(string, "speex-float"))
|
if (pa_streq(string, "speex-float"))
|
||||||
return PA_RESAMPLER_SPEEX_FLOAT_BASE + 3;
|
return PA_RESAMPLER_SPEEX_FLOAT_BASE + 3;
|
||||||
|
|
||||||
return PA_RESAMPLER_INVALID;
|
return PA_RESAMPLER_INVALID;
|
||||||
|
|
|
||||||
|
|
@ -35,23 +35,28 @@
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
#include <pulsecore/core-util.h>
|
||||||
|
|
||||||
static pid_t _gettid(void) {
|
static pid_t _gettid(void) {
|
||||||
return (pid_t) syscall(SYS_gettid);
|
return (pid_t) syscall(SYS_gettid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int translate_error(const char *name) {
|
static int translate_error(const char *name) {
|
||||||
if (strcmp(name, DBUS_ERROR_NO_MEMORY) == 0)
|
if (pa_streq(name, DBUS_ERROR_NO_MEMORY))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
if (strcmp(name, DBUS_ERROR_SERVICE_UNKNOWN) == 0 ||
|
if (pa_streq(name, DBUS_ERROR_SERVICE_UNKNOWN) ||
|
||||||
strcmp(name, DBUS_ERROR_NAME_HAS_NO_OWNER) == 0)
|
pa_streq(name, DBUS_ERROR_NAME_HAS_NO_OWNER))
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
if (strcmp(name, DBUS_ERROR_ACCESS_DENIED) == 0 ||
|
if (pa_streq(name, DBUS_ERROR_ACCESS_DENIED) ||
|
||||||
strcmp(name, DBUS_ERROR_AUTH_FAILED) == 0)
|
pa_streq(name, DBUS_ERROR_AUTH_FAILED))
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
|
||||||
|
|
@ -1124,7 +1124,7 @@ void pa_source_output_set_name(pa_source_output *o, const char *name) {
|
||||||
|
|
||||||
old = pa_proplist_gets(o->proplist, PA_PROP_MEDIA_NAME);
|
old = pa_proplist_gets(o->proplist, PA_PROP_MEDIA_NAME);
|
||||||
|
|
||||||
if (old && name && !strcmp(old, name))
|
if (old && name && pa_streq(old, name))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ pa_strlist* pa_strlist_remove(pa_strlist *l, const char *s) {
|
||||||
pa_assert(s);
|
pa_assert(s);
|
||||||
|
|
||||||
while (l) {
|
while (l) {
|
||||||
if (!strcmp(ITEM_TO_TEXT(l), s)) {
|
if (pa_streq(ITEM_TO_TEXT(l), s)) {
|
||||||
pa_strlist *n = l->next;
|
pa_strlist *n = l->next;
|
||||||
|
|
||||||
if (!prev) {
|
if (!prev) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue