summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArti Trivedi Bora <tbaarti@gmail.com>2012-06-06 01:28:14 +0530
committerTanu Kaskinen <tanuk@iki.fi>2012-06-09 16:22:13 +0300
commit96a52257a90f03478976fe762f544145cf1d681a (patch)
treea01615e75e52a1a493cf225f0077e6954eeb8426
parente5954aca8eadfb628c5689812f22e0d6aed41908 (diff)
downloadpulseaudio-96a52257a90f03478976fe762f544145cf1d681a.tar.gz
pulsecore: Use pa_streq instead of strcmp.
-rw-r--r--src/pulsecore/core-util.c10
-rw-r--r--src/pulsecore/cpu-arm.c8
-rw-r--r--src/pulsecore/modargs.c2
-rw-r--r--src/pulsecore/module.c2
-rw-r--r--src/pulsecore/resampler.c8
-rw-r--r--src/pulsecore/rtkit.c15
-rw-r--r--src/pulsecore/source-output.c2
-rw-r--r--src/pulsecore/strlist.c2
8 files changed, 27 insertions, 22 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 82480c66c..d79d289f1 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -168,7 +168,7 @@ char *pa_win32_get_toplevel(HANDLE handle) {
*p = '\0';
p = strrchr(toplevel, PA_PATH_SEP_CHAR);
- if (p && (strcmp(p + 1, "bin") == 0))
+ if (p && pa_streq(p + 1, "bin"))
*p = '\0';
}
@@ -892,9 +892,9 @@ int pa_parse_boolean(const char *v) {
pa_assert(v);
/* 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;
- 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;
#ifdef HAVE_LANGINFO_H
@@ -1100,7 +1100,7 @@ static int is_group(gid_t gid, const char *name) {
goto finish;
}
- r = strcmp(name, group->gr_name) == 0;
+ r = pa_streq(name, group->gr_name);
finish:
pa_getgrgid_free(group);
@@ -1998,7 +1998,7 @@ pa_bool_t pa_endswith(const char *s, const char *sfx) {
l1 = strlen(s);
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) {
diff --git a/src/pulsecore/cpu-arm.c b/src/pulsecore/cpu-arm.c
index 9c654a3af..a72430968 100644
--- a/src/pulsecore/cpu-arm.c
+++ b/src/pulsecore/cpu-arm.c
@@ -110,13 +110,13 @@ pa_bool_t pa_cpu_init_arm(pa_cpu_arm_flag_t *flags) {
char *current;
while ((current = pa_split_spaces(line, &state))) {
- if (!strcmp(current, "vfp"))
+ if (pa_streq(current, "vfp"))
*flags |= PA_CPU_ARM_VFP;
- else if (!strcmp(current, "edsp"))
+ else if (pa_streq(current, "edsp"))
*flags |= PA_CPU_ARM_EDSP;
- else if (!strcmp(current, "neon"))
+ else if (pa_streq(current, "neon"))
*flags |= PA_CPU_ARM_NEON;
- else if (!strcmp(current, "vfpv3"))
+ else if (pa_streq(current, "vfpv3"))
*flags |= PA_CPU_ARM_VFPV3;
pa_xfree(current);
diff --git a/src/pulsecore/modargs.c b/src/pulsecore/modargs.c
index 555c4d05a..58a704507 100644
--- a/src/pulsecore/modargs.c
+++ b/src/pulsecore/modargs.c
@@ -64,7 +64,7 @@ static int add_key_value(pa_modargs *ma, char *key, char *value, const char* con
if (valid_keys) {
const char*const* v;
for (v = valid_keys; *v; v++)
- if (strcmp(*v, key) == 0)
+ if (pa_streq(*v, key))
break;
if (!*v) {
diff --git a/src/pulsecore/module.c b/src/pulsecore/module.c
index 5eb3572d8..bf554af0e 100644
--- a/src/pulsecore/module.c
+++ b/src/pulsecore/module.c
@@ -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 */
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);
goto fail;
}
diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c
index cd95c5b20..9f1955913 100644
--- a/src/pulsecore/resampler.c
+++ b/src/pulsecore/resampler.c
@@ -39,7 +39,7 @@
#include <pulsecore/macro.h>
#include <pulsecore/strbuf.h>
#include <pulsecore/remap.h>
-
+#include <pulsecore/core-util.h>
#include "ffmpeg/avcodec.h"
#include "resampler.h"
@@ -545,13 +545,13 @@ pa_resample_method_t pa_parse_resample_method(const char *string) {
pa_assert(string);
for (m = 0; m < PA_RESAMPLER_MAX; m++)
- if (!strcmp(string, resample_methods[m]))
+ if (pa_streq(string, resample_methods[m]))
return m;
- if (!strcmp(string, "speex-fixed"))
+ if (pa_streq(string, "speex-fixed"))
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_INVALID;
diff --git a/src/pulsecore/rtkit.c b/src/pulsecore/rtkit.c
index a7dc3d96a..d47610fe9 100644
--- a/src/pulsecore/rtkit.c
+++ b/src/pulsecore/rtkit.c
@@ -35,23 +35,28 @@
#define _GNU_SOURCE
#endif
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/syscall.h>
+#include <pulsecore/core-util.h>
static pid_t _gettid(void) {
return (pid_t) syscall(SYS_gettid);
}
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;
- if (strcmp(name, DBUS_ERROR_SERVICE_UNKNOWN) == 0 ||
- strcmp(name, DBUS_ERROR_NAME_HAS_NO_OWNER) == 0)
+ if (pa_streq(name, DBUS_ERROR_SERVICE_UNKNOWN) ||
+ pa_streq(name, DBUS_ERROR_NAME_HAS_NO_OWNER))
return -ENOENT;
- if (strcmp(name, DBUS_ERROR_ACCESS_DENIED) == 0 ||
- strcmp(name, DBUS_ERROR_AUTH_FAILED) == 0)
+ if (pa_streq(name, DBUS_ERROR_ACCESS_DENIED) ||
+ pa_streq(name, DBUS_ERROR_AUTH_FAILED))
return -EACCES;
return -EIO;
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 844dd223d..1297ec75b 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -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);
- if (old && name && !strcmp(old, name))
+ if (old && name && pa_streq(old, name))
return;
if (name)
diff --git a/src/pulsecore/strlist.c b/src/pulsecore/strlist.c
index b2ba12ba4..4c06fee04 100644
--- a/src/pulsecore/strlist.c
+++ b/src/pulsecore/strlist.c
@@ -74,7 +74,7 @@ pa_strlist* pa_strlist_remove(pa_strlist *l, const char *s) {
pa_assert(s);
while (l) {
- if (!strcmp(ITEM_TO_TEXT(l), s)) {
+ if (pa_streq(ITEM_TO_TEXT(l), s)) {
pa_strlist *n = l->next;
if (!prev) {