[pulseaudio-commits] 4 commits - src/daemon src/modules src/pulsecore src/tests
Tanu Kaskinen
tanuk at kemper.freedesktop.org
Sat Jun 9 06:26:24 PDT 2012
src/daemon/dumpmodules.c | 2 +-
src/daemon/main.c | 2 +-
src/modules/alsa/alsa-mixer.c | 12 ++++++------
src/modules/bluetooth/module-bluetooth-proximity.c | 2 +-
src/modules/dbus/module-dbus-protocol.c | 6 +++---
src/modules/gconf/module-gconf.c | 4 ++--
src/modules/jack/module-jackdbus-detect.c | 2 +-
src/modules/macosx/module-coreaudio-detect.c | 2 +-
src/modules/module-augment-properties.c | 4 ++--
src/modules/module-detect.c | 2 +-
src/modules/module-device-manager.c | 12 ++++++------
src/modules/module-ladspa-sink.c | 6 +++---
src/modules/module-tunnel.c | 4 ++--
src/modules/module-zeroconf-discover.c | 10 +++++-----
src/modules/oss/oss-util.c | 2 +-
src/modules/raop/module-raop-discover.c | 2 +-
src/modules/raop/raop_client.c | 4 ++--
src/modules/rtp/rtp.c | 8 ++++----
src/modules/rtp/rtsp_client.c | 2 +-
src/modules/rtp/sap.c | 2 +-
src/modules/x11/module-x11-publish.c | 4 ++--
src/pulsecore/core-util.c | 10 +++++-----
src/pulsecore/cpu-arm.c | 8 ++++----
src/pulsecore/modargs.c | 2 +-
src/pulsecore/module.c | 2 +-
src/pulsecore/resampler.c | 8 ++++----
src/pulsecore/rtkit.c | 15 ++++++++++-----
src/pulsecore/source-output.c | 2 +-
src/pulsecore/strlist.c | 2 +-
src/tests/usergroup-test.c | 17 +++++++++--------
30 files changed, 83 insertions(+), 77 deletions(-)
New commits:
commit 8fb63dd6e42456108a4db97bfab67b7d48711770
Author: Arti Trivedi Bora <tbaarti at gmail.com>
Date: Wed Jun 6 01:28:16 2012 +0530
daemon: use pa_streq instead of strcmp
diff --git a/src/daemon/dumpmodules.c b/src/daemon/dumpmodules.c
index 009fbe5..6f45e12 100644
--- a/src/daemon/dumpmodules.c
+++ b/src/daemon/dumpmodules.c
@@ -106,7 +106,7 @@ static int is_preloaded(const char *name) {
if ((e = strrchr(buf, '.')))
*e = 0;
- if (!strcmp(name, buf))
+ if (pa_streq(name, buf))
return 1;
}
diff --git a/src/daemon/main.c b/src/daemon/main.c
index da1e0cf..a67bf06 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -199,7 +199,7 @@ static int change_user(void) {
return -1;
}
- if (strcmp(pw->pw_dir, PA_SYSTEM_RUNTIME_PATH) != 0)
+ if (!pa_streq(pw->pw_dir, PA_SYSTEM_RUNTIME_PATH))
pa_log_warn(_("Home directory of user '%s' is not '%s', ignoring."), PA_SYSTEM_USER, PA_SYSTEM_RUNTIME_PATH);
if (pa_make_secure_dir(PA_SYSTEM_RUNTIME_PATH, 0755, pw->pw_uid, gr->gr_gid) < 0) {
commit 41ee562140b482979b7ac1981a25663000f1dc0f
Author: Arti Trivedi Bora <tbaarti at gmail.com>
Date: Wed Jun 6 01:28:15 2012 +0530
tests: use pa_streq instead of strcmp
diff --git a/src/tests/usergroup-test.c b/src/tests/usergroup-test.c
index 3948e0f..956f818 100644
--- a/src/tests/usergroup-test.c
+++ b/src/tests/usergroup-test.c
@@ -30,6 +30,7 @@
#include <errno.h>
#include <pulsecore/usergroup.h>
+#include <pulsecore/core-util.h>
static int load_reference_structs(struct group **gr, struct passwd **pw) {
setpwent();
@@ -46,12 +47,12 @@ static int load_reference_structs(struct group **gr, struct passwd **pw) {
static int compare_group(const struct group *a, const struct group *b) {
char **amem, **bmem;
- if (strcmp(a->gr_name, b->gr_name)) {
+ if (!pa_streq(a->gr_name, b->gr_name)) {
fprintf(stderr, "Group name mismatch: [%s] [%s]\n", a->gr_name, b->gr_name);
return 1;
}
- if (strcmp(a->gr_passwd, b->gr_passwd)) {
+ if (!pa_streq(a->gr_passwd, b->gr_passwd)) {
fprintf(stderr, "Group password mismatch: [%s] [%s]\n", a->gr_passwd, b->gr_passwd);
return 1;
}
@@ -63,7 +64,7 @@ static int compare_group(const struct group *a, const struct group *b) {
/* XXX: Assuming the group ordering is identical. */
for (amem = a->gr_mem, bmem = b->gr_mem; *amem && *bmem; ++amem, ++bmem) {
- if (strcmp(*amem, *bmem)) {
+ if (!pa_streq(*amem, *bmem)) {
fprintf(stderr, "Group member mismatch: [%s] [%s]\n", *amem, *bmem);
return 1;
}
@@ -78,12 +79,12 @@ static int compare_group(const struct group *a, const struct group *b) {
}
static int compare_passwd(const struct passwd *a, const struct passwd *b) {
- if (strcmp(a->pw_name, b->pw_name)) {
+ if (!pa_streq(a->pw_name, b->pw_name)) {
fprintf(stderr, "pw_name mismatch: [%s] [%s]\n", a->pw_name, b->pw_name);
return 1;
}
- if (strcmp(a->pw_passwd, b->pw_passwd)) {
+ if (!pa_streq(a->pw_passwd, b->pw_passwd)) {
fprintf(stderr, "pw_passwd mismatch: [%s] [%s]\n", a->pw_passwd, b->pw_passwd);
return 1;
}
@@ -98,17 +99,17 @@ static int compare_passwd(const struct passwd *a, const struct passwd *b) {
return 1;
}
- if (strcmp(a->pw_gecos, b->pw_gecos)) {
+ if (!pa_streq(a->pw_gecos, b->pw_gecos)) {
fprintf(stderr, "pw_gecos mismatch: [%s] [%s]\n", a->pw_gecos, b->pw_gecos);
return 1;
}
- if (strcmp(a->pw_dir, b->pw_dir)) {
+ if (!pa_streq(a->pw_dir, b->pw_dir)) {
fprintf(stderr, "pw_dir mismatch: [%s] [%s]\n", a->pw_dir, b->pw_dir);
return 1;
}
- if (strcmp(a->pw_shell, b->pw_shell)) {
+ if (!pa_streq(a->pw_shell, b->pw_shell)) {
fprintf(stderr, "pw_shell mismatch: [%s] [%s]\n", a->pw_shell, b->pw_shell);
return 1;
}
commit 96a52257a90f03478976fe762f544145cf1d681a
Author: Arti Trivedi Bora <tbaarti at gmail.com>
Date: Wed Jun 6 01:28:14 2012 +0530
pulsecore: Use pa_streq instead of strcmp.
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 82480c6..d79d289 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 9c654a3..a724309 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 555c4d0..58a7045 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 5eb3572..bf554af 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 cd95c5b..9f19559 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 a7dc3d9..d47610f 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 844dd22..1297ec7 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 b2ba12b..4c06fee 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) {
commit e5954aca8eadfb628c5689812f22e0d6aed41908
Author: Arti Trivedi Bora <tbaarti at gmail.com>
Date: Wed Jun 6 01:28:13 2012 +0530
modules: Use pa_streq instead of strcmp.
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index 260573c..1b2207b 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -2207,22 +2207,22 @@ static int jack_parse_state(
return -1;
}
- if (!strcmp(rvalue,"yes"))
+ if (pa_streq(rvalue, "yes"))
pa = PA_PORT_AVAILABLE_YES;
- else if (!strcmp(rvalue,"no"))
+ else if (pa_streq(rvalue, "no"))
pa = PA_PORT_AVAILABLE_NO;
- else if (!strcmp(rvalue,"unknown"))
+ else if (pa_streq(rvalue, "unknown"))
pa = PA_PORT_AVAILABLE_UNKNOWN;
else {
pa_log("[%s:%u] state must be 'yes','no' or 'unknown' in '%s'", filename, line, section);
return -1;
}
- if (!strcmp(lvalue, "state.unplugged"))
+ if (pa_streq(lvalue, "state.unplugged"))
j->state_unplugged = pa;
else {
j->state_plugged = pa;
- pa_assert(!strcmp(lvalue, "state.plugged"));
+ pa_assert(pa_streq(lvalue, "state.plugged"));
}
return 0;
@@ -3183,7 +3183,7 @@ static void path_set_condense(pa_alsa_path_set *ps, snd_mixer_t *m) {
continue;
PA_LLIST_FOREACH(jb, p2->jacks) {
- if (jb->has_control && !strcmp(jb->alsa_name, ja->alsa_name) &&
+ if (jb->has_control && pa_streq(jb->alsa_name, ja->alsa_name) &&
(ja->state_plugged == jb->state_plugged) &&
(ja->state_unplugged == jb->state_unplugged)) {
exists = TRUE;
diff --git a/src/modules/bluetooth/module-bluetooth-proximity.c b/src/modules/bluetooth/module-bluetooth-proximity.c
index 3247017..7d69e82 100644
--- a/src/modules/bluetooth/module-bluetooth-proximity.c
+++ b/src/modules/bluetooth/module-bluetooth-proximity.c
@@ -228,7 +228,7 @@ static struct bonding* bonding_new(struct userdata *u, const char *a) {
goto fail;
}
- if (strcmp(class, "phone")) {
+ if (!pa_streq(class, "phone")) {
pa_log_info("Found device '%s' of class '%s', ignoring.", a, class);
goto fail;
}
diff --git a/src/modules/dbus/module-dbus-protocol.c b/src/modules/dbus/module-dbus-protocol.c
index c24e1e0..f81c254 100644
--- a/src/modules/dbus/module-dbus-protocol.c
+++ b/src/modules/dbus/module-dbus-protocol.c
@@ -491,13 +491,13 @@ static int get_access_arg(pa_modargs *ma, pa_bool_t *local_access, pa_bool_t *re
if (!(value = pa_modargs_get_value(ma, "access", NULL)))
return 0;
- if (!strcmp(value, "local")) {
+ if (pa_streq(value, "local")) {
*local_access = TRUE;
*remote_access = FALSE;
- } else if (!strcmp(value, "remote")) {
+ } else if (pa_streq(value, "remote")) {
*local_access = FALSE;
*remote_access = TRUE;
- } else if (!strcmp(value, "local,remote")) {
+ } else if (pa_streq(value, "local,remote")) {
*local_access = TRUE;
*remote_access = TRUE;
} else
diff --git a/src/modules/gconf/module-gconf.c b/src/modules/gconf/module-gconf.c
index 3bad911..c951d90 100644
--- a/src/modules/gconf/module-gconf.c
+++ b/src/modules/gconf/module-gconf.c
@@ -173,8 +173,8 @@ static void load_module(
if (!is_new) {
if (m->items[i].index != PA_INVALID_INDEX &&
- strcmp(m->items[i].name, name) == 0 &&
- strcmp(m->items[i].args, args) == 0)
+ pa_streq(m->items[i].name, name) &&
+ pa_streq(m->items[i].args, args))
return;
unload_one_module(u, m, i);
diff --git a/src/modules/jack/module-jackdbus-detect.c b/src/modules/jack/module-jackdbus-detect.c
index 41933c7..10408ea 100644
--- a/src/modules/jack/module-jackdbus-detect.c
+++ b/src/modules/jack/module-jackdbus-detect.c
@@ -186,7 +186,7 @@ static DBusHandlerResult dbus_filter_handler(DBusConnection *c, DBusMessage *s,
DBUS_TYPE_STRING, &new,
DBUS_TYPE_INVALID))
goto finish;
- if (strcmp(name, JACK_SERVICE_NAME))
+ if (!pa_streq(name, JACK_SERVICE_NAME))
goto finish;
ensure_ports_stopped(u);
diff --git a/src/modules/macosx/module-coreaudio-detect.c b/src/modules/macosx/module-coreaudio-detect.c
index f4f2ee2..4652e6f 100644
--- a/src/modules/macosx/module-coreaudio-detect.c
+++ b/src/modules/macosx/module-coreaudio-detect.c
@@ -85,7 +85,7 @@ static int ca_device_added(struct pa_module *m, AudioObjectID id) {
size = sizeof(tmp);
err = AudioObjectGetPropertyData(id, &property_address, 0, NULL, &size, tmp);
- if (!err && strcmp(tmp, "pulseaudio.org") == 0)
+ if (!err && pa_streq(tmp, "pulseaudio.org"))
return 0;
if (u->ioproc_frames)
diff --git a/src/modules/module-augment-properties.c b/src/modules/module-augment-properties.c
index 05f6f0a..f280eae 100644
--- a/src/modules/module-augment-properties.c
+++ b/src/modules/module-augment-properties.c
@@ -183,8 +183,8 @@ static void update_rule(struct rule *r) {
if ((desktopfiles_dir = opendir(DESKTOPFILEDIR))) {
while ((dir = readdir(desktopfiles_dir))) {
if (dir->d_type != DT_DIR
- || strcmp(dir->d_name, ".") == 0
- || strcmp(dir->d_name, "..") == 0)
+ || pa_streq(dir->d_name, ".")
+ || pa_streq(dir->d_name, ".."))
continue;
pa_xfree(fn);
diff --git a/src/modules/module-detect.c b/src/modules/module-detect.c
index bb4994c..a16f7fe 100644
--- a/src/modules/module-detect.c
+++ b/src/modules/module-detect.c
@@ -142,7 +142,7 @@ static int detect_oss(pa_core *c, int just_one) {
line[strcspn(line, "\r\n")] = 0;
if (!b) {
- b = strcmp(line, "Audio devices:") == 0 || strcmp(line, "Installed devices:") == 0;
+ b = pa_streq(line, "Audio devices:") || pa_streq(line, "Installed devices:");
continue;
}
diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c
index fe48d4f..12eddec 100644
--- a/src/modules/module-device-manager.c
+++ b/src/modules/module-device-manager.c
@@ -537,7 +537,7 @@ static uint32_t get_role_index(const char* role) {
pa_assert(role);
for (uint32_t i = ROLE_NONE; i < NUM_ROLES; ++i)
- if (strcmp(role, role_names[i]) == 0)
+ if (pa_streq(role, role_names[i]))
return i;
return PA_INVALID_INDEX;
@@ -551,7 +551,7 @@ static void update_highest_priority_device_indexes(struct userdata *u, const cha
pa_assert(u);
pa_assert(prefix);
- sink_mode = (strcmp(prefix, "sink:") == 0);
+ sink_mode = pa_streq(prefix, "sink:");
if (sink_mode)
indexes = &u->preferred_sinks;
@@ -592,7 +592,7 @@ static void update_highest_priority_device_indexes(struct userdata *u, const cha
PA_IDXSET_FOREACH(sink, u->core->sinks, idx) {
if ((pa_sink*) ignore_device == sink)
continue;
- if (strcmp(sink->name, device_name) == 0) {
+ if (pa_streq(sink->name, device_name)) {
found = TRUE;
idx = sink->index; /* Is this needed? */
break;
@@ -604,7 +604,7 @@ static void update_highest_priority_device_indexes(struct userdata *u, const cha
PA_IDXSET_FOREACH(source, u->core->sources, idx) {
if ((pa_source*) ignore_device == source)
continue;
- if (strcmp(source->name, device_name) == 0) {
+ if (pa_streq(source->name, device_name)) {
found = TRUE;
idx = source->index; /* Is this needed? */
break;
@@ -1159,7 +1159,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
if ((device_name = get_name(name, "sink:"))) {
pa_sink* s;
PA_IDXSET_FOREACH(s, u->core->sinks, idx) {
- if (strcmp(s->name, device_name) == 0) {
+ if (pa_streq(s->name, device_name)) {
found_index = s->index;
break;
}
@@ -1168,7 +1168,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
} else if ((device_name = get_name(name, "source:"))) {
pa_source* s;
PA_IDXSET_FOREACH(s, u->core->sources, idx) {
- if (strcmp(s->name, device_name) == 0) {
+ if (pa_streq(s->name, device_name)) {
found_index = s->index;
break;
}
diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c
index be05715..500f8f6 100644
--- a/src/modules/module-ladspa-sink.c
+++ b/src/modules/module-ladspa-sink.c
@@ -562,7 +562,7 @@ int pa__init(pa_module*m) {
goto fail;
}
- if (strcmp(d->Label, label) == 0)
+ if (pa_streq(d->Label, label))
break;
}
@@ -627,7 +627,7 @@ int pa__init(pa_module*m) {
for (p = 0; p < d->PortCount; p++) {
- if (strcmp(d->PortNames[p], pname) == 0) {
+ if (pa_streq(d->PortNames[p], pname)) {
if (LADSPA_IS_PORT_AUDIO(d->PortDescriptors[p]) && LADSPA_IS_PORT_INPUT(d->PortDescriptors[p])) {
input_ladspaport[c] = p;
} else {
@@ -653,7 +653,7 @@ int pa__init(pa_module*m) {
goto fail;
}
for (p = 0; p < d->PortCount; p++) {
- if (strcmp(d->PortNames[p], pname) == 0) {
+ if (pa_streq(d->PortNames[p], pname)) {
if (LADSPA_IS_PORT_AUDIO(d->PortDescriptors[p]) && LADSPA_IS_PORT_OUTPUT(d->PortDescriptors[p])) {
output_ladspaport[c] = p;
} else {
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index 554eecf..e336d15 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -1136,7 +1136,7 @@ static void sink_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_t
pa_proplist_free(pl);
- if (!u->sink_name || strcmp(name, u->sink_name))
+ if (!u->sink_name || !pa_streq(name, u->sink_name))
return;
pa_xfree(u->device_description);
@@ -1347,7 +1347,7 @@ static void source_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa
pa_proplist_free(pl);
- if (!u->source_name || strcmp(name, u->source_name))
+ if (!u->source_name || !pa_streq(name, u->source_name))
return;
pa_xfree(u->device_description);
diff --git a/src/modules/module-zeroconf-discover.c b/src/modules/module-zeroconf-discover.c
index cd076aa..b17f6e5 100644
--- a/src/modules/module-zeroconf-discover.c
+++ b/src/modules/module-zeroconf-discover.c
@@ -163,17 +163,17 @@ static void resolver_cb(
char *key, *value;
pa_assert_se(avahi_string_list_get_pair(l, &key, &value, NULL) == 0);
- if (strcmp(key, "device") == 0) {
+ if (pa_streq(key, "device")) {
pa_xfree(device);
device = value;
value = NULL;
- } else if (strcmp(key, "rate") == 0)
+ } else if (pa_streq(key, "rate"))
ss.rate = (uint32_t) atoi(value);
- else if (strcmp(key, "channels") == 0)
+ else if (pa_streq(key, "channels"))
ss.channels = (uint8_t) atoi(value);
- else if (strcmp(key, "format") == 0)
+ else if (pa_streq(key, "format"))
ss.format = pa_parse_sample_format(value);
- else if (strcmp(key, "channel_map") == 0) {
+ else if (pa_streq(key, "channel_map")) {
pa_channel_map_parse(&cm, value);
channel_map_set = TRUE;
}
diff --git a/src/modules/oss/oss-util.c b/src/modules/oss/oss-util.c
index 9412a87..3c7f0eb 100644
--- a/src/modules/oss/oss-util.c
+++ b/src/modules/oss/oss-util.c
@@ -359,7 +359,7 @@ int pa_oss_get_hw_description(const char *dev, char *name, size_t l) {
line[strcspn(line, "\r\n")] = 0;
if (!b) {
- b = strcmp(line, "Audio devices:") == 0;
+ b = pa_streq(line, "Audio devices:");
continue;
}
diff --git a/src/modules/raop/module-raop-discover.c b/src/modules/raop/module-raop-discover.c
index 4ebe5fc..7499f63 100644
--- a/src/modules/raop/module-raop-discover.c
+++ b/src/modules/raop/module-raop-discover.c
@@ -166,7 +166,7 @@ static void resolver_cb(
pa_assert_se(avahi_string_list_get_pair(l, &key, &value, NULL) == 0);
pa_log_debug("Found key: '%s' with value: '%s'", key, value);
- if (strcmp(key, "device") == 0) {
+ if (pa_streq(key, "device")) {
pa_xfree(device);
device = value;
value = NULL;
diff --git a/src/modules/raop/raop_client.c b/src/modules/raop/raop_client.c
index bbbce5b..b11cafb 100644
--- a/src/modules/raop/raop_client.c
+++ b/src/modules/raop/raop_client.c
@@ -303,11 +303,11 @@ static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* he
while ((token = pa_split(aj, delimiters, &token_state))) {
if ((pc = strstr(token, "="))) {
*pc = 0;
- if (!strcmp(token, "type") && !strcmp(pc+1, "digital")) {
+ if (pa_streq(token, "type") && pa_streq(pc+1, "digital")) {
c->jack_type = JACK_TYPE_DIGITAL;
}
} else {
- if (!strcmp(token,"connected"))
+ if (pa_streq(token, "connected"))
c->jack_status = JACK_STATUS_CONNECTED;
}
pa_xfree(token);
diff --git a/src/modules/rtp/rtp.c b/src/modules/rtp/rtp.c
index 178717c..04e756d 100644
--- a/src/modules/rtp/rtp.c
+++ b/src/modules/rtp/rtp.c
@@ -398,13 +398,13 @@ const char* pa_rtp_format_to_string(pa_sample_format_t f) {
pa_sample_format_t pa_rtp_string_to_format(const char *s) {
pa_assert(s);
- if (!(strcmp(s, "L16")))
+ if (pa_streq(s, "L16"))
return PA_SAMPLE_S16BE;
- else if (!strcmp(s, "L8"))
+ else if (pa_streq(s, "L8"))
return PA_SAMPLE_U8;
- else if (!strcmp(s, "PCMA"))
+ else if (pa_streq(s, "PCMA"))
return PA_SAMPLE_ALAW;
- else if (!strcmp(s, "PCMU"))
+ else if (pa_streq(s, "PCMU"))
return PA_SAMPLE_ULAW;
else
return PA_SAMPLE_INVALID;
diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c
index 71692c2..2c8b2dc 100644
--- a/src/modules/rtp/rtsp_client.c
+++ b/src/modules/rtp/rtsp_client.c
@@ -187,7 +187,7 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
*s2p = '\0';
s2p -= 1;
}
- if (c->waiting && 0 == strcmp("RTSP/1.0 200 OK", s2)) {
+ if (c->waiting && pa_streq(s2, "RTSP/1.0 200 OK")) {
c->waiting = 0;
if (c->response_headers)
pa_headerlist_free(c->response_headers);
diff --git a/src/modules/rtp/sap.c b/src/modules/rtp/sap.c
index 4d8bf66..f02d53f 100644
--- a/src/modules/rtp/sap.c
+++ b/src/modules/rtp/sap.c
@@ -212,7 +212,7 @@ int pa_sap_recv(pa_sap_context *c, pa_bool_t *goodbye) {
e = buf + k;
size -= (int) k;
- if ((unsigned) size >= sizeof(MIME_TYPE) && !strcmp(e, MIME_TYPE)) {
+ if ((unsigned) size >= sizeof(MIME_TYPE) && pa_streq(e, MIME_TYPE)) {
e += sizeof(MIME_TYPE);
size -= (int) sizeof(MIME_TYPE);
} else if ((unsigned) size < sizeof(PA_SDP_HEADER)-1 || strncmp(e, PA_SDP_HEADER, sizeof(PA_SDP_HEADER)-1)) {
diff --git a/src/modules/x11/module-x11-publish.c b/src/modules/x11/module-x11-publish.c
index 643b735..16ea977 100644
--- a/src/modules/x11/module-x11-publish.c
+++ b/src/modules/x11/module-x11-publish.c
@@ -103,7 +103,7 @@ static pa_hook_result_t servers_changed_cb(void *hook_data, void *call_data, voi
pa_assert(u);
screen = DefaultScreen(pa_x11_wrapper_get_display(u->x11_wrapper));
- if (!pa_x11_get_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), screen, "PULSE_ID", t, sizeof(t)) || strcmp(t, u->id)) {
+ if (!pa_x11_get_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), screen, "PULSE_ID", t, sizeof(t)) || !pa_streq(t, u->id)) {
pa_log_warn("PulseAudio information vanished from X11!");
return PA_HOOK_OK;
}
@@ -217,7 +217,7 @@ void pa__done(pa_module*m) {
int screen = DefaultScreen(pa_x11_wrapper_get_display(u->x11_wrapper));
/* Yes, here is a race condition */
- if (!pa_x11_get_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), screen, "PULSE_ID", t, sizeof(t)) || strcmp(t, u->id))
+ if (!pa_x11_get_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), screen, "PULSE_ID", t, sizeof(t)) || !pa_streq(t, u->id))
pa_log_warn("PulseAudio information vanished from X11!");
else {
pa_x11_del_prop(pa_x11_wrapper_get_xcb_connection(u->x11_wrapper), screen, "PULSE_ID");
More information about the pulseaudio-commits
mailing list