mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
llvm-clang-analyzer: drop a few unnecessary assignments and other trivial fixes
This commit is contained in:
parent
b2606cf641
commit
f5046759cd
20 changed files with 49 additions and 59 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue