summaryrefslogtreecommitdiffstats
path: root/src/pulsecore
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-09-08 23:46:23 +0200
committerLennart Poettering <lennart@poettering.net>2009-09-08 23:46:23 +0200
commitf5046759cdd72daf5ba3b31c9dfc7b8d5be6bc9b (patch)
treeb179f9d8d43310bfb8ef85a60d096d1d7ff98760 /src/pulsecore
parentb2606cf641f01f688dcb05abcfef3ba003e74efb (diff)
llvm-clang-analyzer: drop a few unnecessary assignments and other trivial fixes
Diffstat (limited to 'src/pulsecore')
-rw-r--r--src/pulsecore/core-util.c13
-rw-r--r--src/pulsecore/flist.c22
-rw-r--r--src/pulsecore/memtrap.c4
-rw-r--r--src/pulsecore/pid.c4
-rw-r--r--src/pulsecore/protocol-esound.c4
-rw-r--r--src/pulsecore/protocol-native.c3
-rw-r--r--src/pulsecore/protocol-simple.c2
-rw-r--r--src/pulsecore/sink-input.c3
-rw-r--r--src/pulsecore/socket-client.c4
9 files changed, 30 insertions, 29 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 1daa46eb..d64c7388 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -591,13 +591,13 @@ static int set_scheduler(int rtprio) {
sp.sched_priority = rtprio;
#ifdef SCHED_RESET_ON_FORK
- if ((r = pthread_setschedparam(pthread_self(), SCHED_RR|SCHED_RESET_ON_FORK, &sp)) == 0) {
+ if (pthread_setschedparam(pthread_self(), SCHED_RR|SCHED_RESET_ON_FORK, &sp) == 0) {
pa_log_debug("SCHED_RR|SCHED_RESET_ON_FORK worked.");
return 0;
}
#endif
- if ((r = pthread_setschedparam(pthread_self(), SCHED_RR, &sp)) == 0) {
+ if (pthread_setschedparam(pthread_self(), SCHED_RR, &sp) == 0) {
pa_log_debug("SCHED_RR worked.");
return 0;
}
@@ -786,7 +786,6 @@ int pa_match(const char *expr, const char *v) {
/* Try to parse a boolean string value.*/
int pa_parse_boolean(const char *v) {
const char *expr;
- int r;
pa_assert(v);
/* First we check language independant */
@@ -798,12 +797,12 @@ int pa_parse_boolean(const char *v) {
/* And then we check language dependant */
if ((expr = nl_langinfo(YESEXPR)))
if (expr[0])
- if ((r = pa_match(expr, v)) > 0)
+ if (pa_match(expr, v) > 0)
return 1;
if ((expr = nl_langinfo(NOEXPR)))
if (expr[0])
- if ((r = pa_match(expr, v)) > 0)
+ if (pa_match(expr, v) > 0)
return 0;
errno = EINVAL;
@@ -1195,7 +1194,7 @@ char* pa_strip_nl(char *s) {
/* Create a temporary lock file and lock it. */
int pa_lock_lockfile(const char *fn) {
- int fd = -1;
+ int fd;
pa_assert(fn);
for (;;) {
@@ -1238,8 +1237,6 @@ int pa_lock_lockfile(const char *fn) {
fd = -1;
goto fail;
}
-
- fd = -1;
}
return fd;
diff --git a/src/pulsecore/flist.c b/src/pulsecore/flist.c
index 6fb944f9..7e5ee244 100644
--- a/src/pulsecore/flist.c
+++ b/src/pulsecore/flist.c
@@ -130,15 +130,22 @@ void pa_flist_free(pa_flist *l, pa_free_cb_t free_cb) {
}
int pa_flist_push(pa_flist*l, void *p) {
- unsigned idx, n, len;
+ unsigned idx, n;
pa_atomic_ptr_t*cells;
+#ifdef PROFILE
+ unsigned len;
+#endif
pa_assert(l);
pa_assert(p);
cells = PA_FLIST_CELLS(l);
- n = len = l->size + N_EXTRA_SCAN - (unsigned) pa_atomic_load(&l->length);
+ n = l->size + N_EXTRA_SCAN - (unsigned) pa_atomic_load(&l->length);
+
+#ifdef PROFILE
+ len = n;
+#endif
_Y;
idx = reduce(l, (unsigned) pa_atomic_load(&l->write_idx));
@@ -171,14 +178,21 @@ int pa_flist_push(pa_flist*l, void *p) {
}
void* pa_flist_pop(pa_flist*l) {
- unsigned idx, len, n;
+ unsigned idx, n;
pa_atomic_ptr_t *cells;
+#ifdef PROFILE
+ unsigned len;
+#endif
pa_assert(l);
cells = PA_FLIST_CELLS(l);
- n = len = (unsigned) pa_atomic_load(&l->length) + N_EXTRA_SCAN;
+ n = (unsigned) pa_atomic_load(&l->length) + N_EXTRA_SCAN;
+
+#ifdef PROFILE
+ len = n;
+#endif
_Y;
idx = reduce(l, (unsigned) pa_atomic_load(&l->read_idx));
diff --git a/src/pulsecore/memtrap.c b/src/pulsecore/memtrap.c
index c647e507..373872c1 100644
--- a/src/pulsecore/memtrap.c
+++ b/src/pulsecore/memtrap.c
@@ -200,13 +200,13 @@ pa_memtrap *pa_memtrap_update(pa_memtrap *m, const void *start, size_t size) {
goto unlock;
memtrap_unlink(m, j);
- j = pa_aupdate_write_swap(aupdate);
+ pa_aupdate_write_swap(aupdate);
m->start = (void*) start;
m->size = size;
pa_atomic_store(&m->bad, 0);
- j = pa_aupdate_write_swap(aupdate);
+ pa_assert_se(pa_aupdate_write_swap(aupdate) == j);
memtrap_link(m, j);
unlock:
diff --git a/src/pulsecore/pid.c b/src/pulsecore/pid.c
index 00878462..996946c2 100644
--- a/src/pulsecore/pid.c
+++ b/src/pulsecore/pid.c
@@ -81,7 +81,7 @@ static pid_t read_pid(const char *fn, int fd) {
}
static int open_pid_file(const char *fn, int mode) {
- int fd = -1;
+ int fd;
pa_assert(fn);
@@ -123,8 +123,6 @@ static int open_pid_file(const char *fn, int mode) {
fd = -1;
goto fail;
}
-
- fd = -1;
}
return fd;
diff --git a/src/pulsecore/protocol-esound.c b/src/pulsecore/protocol-esound.c
index 480af6d5..2326eb3a 100644
--- a/src/pulsecore/protocol-esound.c
+++ b/src/pulsecore/protocol-esound.c
@@ -771,7 +771,6 @@ static int esd_proto_stream_pan(connection *c, esd_proto_t request, const void *
memcpy(&rvolume, data, sizeof(uint32_t));
rvolume = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, rvolume);
- data = (const char*)data + sizeof(uint32_t);
if ((conn = pa_idxset_get_by_index(c->protocol->connections, idx)) && conn->sink_input) {
pa_cvolume volume;
@@ -809,7 +808,6 @@ static int esd_proto_sample_pan(connection *c, esd_proto_t request, const void *
memcpy(&rvolume, data, sizeof(uint32_t));
rvolume = PA_MAYBE_UINT32_SWAP(c->swap_byte_order, rvolume);
- data = (const char*)data + sizeof(uint32_t);
volume.values[0] = (lvolume*PA_VOLUME_NORM)/ESD_VOLUME_BASE;
volume.values[1] = (rvolume*PA_VOLUME_NORM)/ESD_VOLUME_BASE;
@@ -1123,7 +1121,7 @@ static int do_read(connection *c) {
ssize_t r;
size_t l;
void *p;
- size_t space;
+ size_t space = 0;
pa_assert(c->input_memblockq);
diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index d961dba2..0215c233 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -628,7 +628,6 @@ static record_stream* record_stream_new(
record_stream *s;
pa_source_output *source_output = NULL;
- size_t base;
pa_source_output_new_data data;
pa_assert(c);
@@ -682,7 +681,7 @@ static record_stream* record_stream_new(
0,
s->buffer_attr.maxlength,
0,
- base = pa_frame_size(&source_output->sample_spec),
+ pa_frame_size(&source_output->sample_spec),
1,
0,
0,
diff --git a/src/pulsecore/protocol-simple.c b/src/pulsecore/protocol-simple.c
index d66db4b7..a9f73896 100644
--- a/src/pulsecore/protocol-simple.c
+++ b/src/pulsecore/protocol-simple.c
@@ -154,7 +154,7 @@ static int do_read(connection *c) {
ssize_t r;
size_t l;
void *p;
- size_t space;
+ size_t space = 0;
connection_assert_ref(c);
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index adda2aff..5f79ab1e 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -1152,7 +1152,6 @@ pa_bool_t pa_sink_input_may_move_to(pa_sink_input *i, pa_sink *dest) {
/* Called from main context */
int pa_sink_input_start_move(pa_sink_input *i) {
pa_source_output *o, *p = NULL;
- pa_sink *origin;
int r;
pa_sink_input_assert_ref(i);
@@ -1166,8 +1165,6 @@ int pa_sink_input_start_move(pa_sink_input *i) {
if ((r = pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_START], i)) < 0)
return r;
- origin = i->sink;
-
/* Kill directly connected outputs */
while ((o = pa_idxset_first(i->direct_outputs, NULL))) {
pa_assert(o != p);
diff --git a/src/pulsecore/socket-client.c b/src/pulsecore/socket-client.c
index 24535157..c9cfdbe3 100644
--- a/src/pulsecore/socket-client.c
+++ b/src/pulsecore/socket-client.c
@@ -202,8 +202,6 @@ static void connect_io_cb(pa_mainloop_api*m, pa_io_event *e, int fd, pa_io_event
}
static int do_connect(pa_socket_client *c, const struct sockaddr *sa, socklen_t len) {
- int r;
-
pa_assert(c);
pa_assert(PA_REFCNT_VALUE(c) >= 1);
pa_assert(sa);
@@ -211,7 +209,7 @@ static int do_connect(pa_socket_client *c, const struct sockaddr *sa, socklen_t
pa_make_fd_nonblock(c->fd);
- if ((r = connect(c->fd, sa, len)) < 0) {
+ if (connect(c->fd, sa, len) < 0) {
#ifdef OS_IS_WIN32
if (WSAGetLastError() != EWOULDBLOCK) {
pa_log_debug("connect(): %d", WSAGetLastError());