[pulseaudio-discuss] [PATCH 2/7] Cleanup !! for bool

Peter Meerwald pmeerw at pmeerw.net
Thu Oct 23 08:35:45 PDT 2014


From: Peter Meerwald <p.meerwald at bct-electronic.com>

!!x makes no sense if x is bool (this is a leftover from the
convertion pa_bool_t -> bool, d806b197)

Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
 src/daemon/main.c                 |   12 ++++++------
 src/modules/module-tunnel.c       |   12 ++++++------
 src/modules/rtp/module-rtp-send.c |    2 +-
 src/pulse/context.c               |    4 ++--
 src/pulsecore/iochannel.c         |    2 +-
 src/pulsecore/memblock.c          |    2 +-
 src/pulsecore/pid.c               |    2 +-
 src/pulsecore/sink-input.c        |    2 +-
 src/pulsecore/sink.c              |    2 +-
 src/pulsecore/sink.h              |    2 +-
 src/pulsecore/source-output.c     |    2 +-
 src/pulsecore/source.c            |    2 +-
 12 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/src/daemon/main.c b/src/daemon/main.c
index 4fd245a..d2a8a8a 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -1009,11 +1009,11 @@ int main(int argc, char *argv[]) {
     c->scache_idle_time = conf->scache_idle_time;
     c->resample_method = conf->resample_method;
     c->realtime_priority = conf->realtime_priority;
-    c->realtime_scheduling = !!conf->realtime_scheduling;
-    c->disable_remixing = !!conf->disable_remixing;
-    c->disable_lfe_remixing = !!conf->disable_lfe_remixing;
-    c->deferred_volume = !!conf->deferred_volume;
-    c->running_as_daemon = !!conf->daemonize;
+    c->realtime_scheduling = conf->realtime_scheduling;
+    c->disable_remixing = conf->disable_remixing;
+    c->disable_lfe_remixing = conf->disable_lfe_remixing;
+    c->deferred_volume = conf->deferred_volume;
+    c->running_as_daemon = conf->daemonize;
     c->disallow_exit = conf->disallow_exit;
     c->flat_volumes = conf->flat_volumes;
 #ifdef HAVE_DBUS
@@ -1081,7 +1081,7 @@ int main(int argc, char *argv[]) {
 
     /* We completed the initial module loading, so let's disable it
      * from now on, if requested */
-    c->disallow_module_loading = !!conf->disallow_module_loading;
+    c->disallow_module_loading = conf->disallow_module_loading;
 
 #ifdef HAVE_DBUS
     if (!conf->system_instance) {
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index 193d091..69547eb 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -304,9 +304,9 @@ static void command_suspended(pa_pdispatch *pd,  uint32_t command,  uint32_t tag
     pa_log_debug("Server reports device suspend.");
 
 #ifdef TUNNEL_SINK
-    pa_asyncmsgq_send(u->sink->asyncmsgq, PA_MSGOBJECT(u->sink), SINK_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(!!suspended), 0, NULL);
+    pa_asyncmsgq_send(u->sink->asyncmsgq, PA_MSGOBJECT(u->sink), SINK_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(suspended), 0, NULL);
 #else
-    pa_asyncmsgq_send(u->source->asyncmsgq, PA_MSGOBJECT(u->source), SOURCE_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(!!suspended), 0, NULL);
+    pa_asyncmsgq_send(u->source->asyncmsgq, PA_MSGOBJECT(u->source), SOURCE_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(suspended), 0, NULL);
 #endif
 
     request_latency(u);
@@ -337,9 +337,9 @@ static void command_moved(pa_pdispatch *pd,  uint32_t command,  uint32_t tag, pa
     pa_log_debug("Server reports a stream move.");
 
 #ifdef TUNNEL_SINK
-    pa_asyncmsgq_send(u->sink->asyncmsgq, PA_MSGOBJECT(u->sink), SINK_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(!!suspended), 0, NULL);
+    pa_asyncmsgq_send(u->sink->asyncmsgq, PA_MSGOBJECT(u->sink), SINK_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(suspended), 0, NULL);
 #else
-    pa_asyncmsgq_send(u->source->asyncmsgq, PA_MSGOBJECT(u->source), SOURCE_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(!!suspended), 0, NULL);
+    pa_asyncmsgq_send(u->source->asyncmsgq, PA_MSGOBJECT(u->source), SOURCE_MESSAGE_REMOTE_SUSPEND, PA_UINT32_TO_PTR(suspended), 0, NULL);
 #endif
 
     request_latency(u);
@@ -457,7 +457,7 @@ static void stream_cork(struct userdata *u, bool cork) {
 #endif
     pa_tagstruct_putu32(t, u->ctag++);
     pa_tagstruct_putu32(t, u->channel);
-    pa_tagstruct_put_boolean(t, !!cork);
+    pa_tagstruct_put_boolean(t, cork);
     pa_pstream_send_tagstruct(u->pstream, t);
 
     request_latency(u);
@@ -1251,7 +1251,7 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command,  uint32_t tag
 
     pa_assert(u->sink);
 
-    if ((u->version < 11 || !!mute == !!u->sink->muted) &&
+    if ((u->version < 11 || mute == u->sink->muted) &&
         pa_cvolume_equal(&volume, &u->sink->real_volume))
         return;
 
diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index 0cc595b..7347f78 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -398,7 +398,7 @@ int pa__init(pa_module*m) {
 #endif
     }
 
-    j = !!loop;
+    j = loop;
     if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &j, sizeof(j)) < 0 ||
         setsockopt(sap_fd, IPPROTO_IP, IP_MULTICAST_LOOP, &j, sizeof(j)) < 0) {
         pa_log("IP_MULTICAST_LOOP failed: %s", pa_cstrerror(errno));
diff --git a/src/pulse/context.c b/src/pulse/context.c
index 8897de0..ec9f3ac 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -831,7 +831,7 @@ static int try_next_connection(pa_context *c) {
         if (!(c->client = pa_socket_client_new_string(c->mainloop, c->use_rtclock, u, PA_NATIVE_DEFAULT_PORT)))
             continue;
 
-        c->is_local = !!pa_socket_client_is_local(c->client);
+        c->is_local = pa_socket_client_is_local(c->client);
         pa_socket_client_set_callback(c->client, on_connection, c);
         break;
     }
@@ -1230,7 +1230,7 @@ int pa_context_is_local(pa_context *c) {
     PA_CHECK_VALIDITY_RETURN_ANY(c, !pa_detect_fork(), PA_ERR_FORKED, -1);
     PA_CHECK_VALIDITY_RETURN_ANY(c, PA_CONTEXT_IS_GOOD(c->state), PA_ERR_BADSTATE, -1);
 
-    return !!c->is_local;
+    return c->is_local;
 }
 
 pa_operation* pa_context_set_name(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata) {
diff --git a/src/pulsecore/iochannel.c b/src/pulsecore/iochannel.c
index 2971c89..6b1fc7a 100644
--- a/src/pulsecore/iochannel.c
+++ b/src/pulsecore/iochannel.c
@@ -481,7 +481,7 @@ void pa_iochannel_set_callback(pa_iochannel*io, pa_iochannel_cb_t _callback, voi
 void pa_iochannel_set_noclose(pa_iochannel*io, bool b) {
     pa_assert(io);
 
-    io->no_close = !!b;
+    io->no_close = b;
 }
 
 void pa_iochannel_socket_peer_to_string(pa_iochannel*io, char*s, size_t l) {
diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index f57b106..f8b008f 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -910,7 +910,7 @@ int pa_mempool_get_shm_id(pa_mempool *p, uint32_t *id) {
 bool pa_mempool_is_shared(pa_mempool *p) {
     pa_assert(p);
 
-    return !!p->memory.shared;
+    return p->memory.shared;
 }
 
 /* For receiving blocks from other nodes */
diff --git a/src/pulsecore/pid.c b/src/pulsecore/pid.c
index e347884..c70b989 100644
--- a/src/pulsecore/pid.c
+++ b/src/pulsecore/pid.c
@@ -174,7 +174,7 @@ static int proc_name_ours(pid_t pid, const char *procname) {
         }
 /*#endif*/
 
-        return !!good;
+        return good;
     }
 #else
 
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index b9698b9..fa379ea 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -179,7 +179,7 @@ void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, bool mute) {
     pa_assert(data);
 
     data->muted_is_set = true;
-    data->muted = !!mute;
+    data->muted = mute;
 }
 
 bool pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink *s, bool save) {
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
index a8a865b..46b6eec 100644
--- a/src/pulsecore/sink.c
+++ b/src/pulsecore/sink.c
@@ -126,7 +126,7 @@ void pa_sink_new_data_set_muted(pa_sink_new_data *data, bool mute) {
     pa_assert(data);
 
     data->muted_is_set = true;
-    data->muted = !!mute;
+    data->muted = mute;
 }
 
 void pa_sink_new_data_set_port(pa_sink_new_data *data, const char *port) {
diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h
index 9ff5360..d18e0be 100644
--- a/src/pulsecore/sink.h
+++ b/src/pulsecore/sink.h
@@ -356,7 +356,7 @@ typedef struct pa_sink_new_data {
     pa_channel_map channel_map;
     uint32_t alternate_sample_rate;
     pa_cvolume volume;
-    bool muted :1;
+    bool muted:1;
 
     bool sample_spec_is_set:1;
     bool channel_map_is_set:1;
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 0012be3..90e86fe 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -122,7 +122,7 @@ void pa_source_output_new_data_set_muted(pa_source_output_new_data *data, bool m
     pa_assert(data);
 
     data->muted_is_set = true;
-    data->muted = !!mute;
+    data->muted = mute;
 }
 
 bool pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_source *s, bool save) {
diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
index 6d32666..77fa510 100644
--- a/src/pulsecore/source.c
+++ b/src/pulsecore/source.c
@@ -117,7 +117,7 @@ void pa_source_new_data_set_muted(pa_source_new_data *data, bool mute) {
     pa_assert(data);
 
     data->muted_is_set = true;
-    data->muted = !!mute;
+    data->muted = mute;
 }
 
 void pa_source_new_data_set_port(pa_source_new_data *data, const char *port) {
-- 
1.7.9.5



More information about the pulseaudio-discuss mailing list