kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16.git/commit/?id=47d955586120fb74d529098b5695d3e13542c63e

commit 47d955586120fb74d529098b5695d3e13542c63e
Author: Kim Woelders <k...@woelders.dk>
Date:   Tue May 5 06:17:53 2020 +0200

    Minor cleanups in sound players
    
    The sample pointers will never be NULL in _Play() and _Destroy() so drop
    checks.
    
    Also drop some pointless pointer clearing.
---
 src/sound_esd.c   |  7 ++-----
 src/sound_pa.c    | 12 +++++-------
 src/sound_sndio.c |  7 ++-----
 3 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/sound_esd.c b/src/sound_esd.c
index 28c67717..6c0d8e84 100644
--- a/src/sound_esd.c
+++ b/src/sound_esd.c
@@ -95,9 +95,6 @@ _sound_esd_Load(const char *file)
 static void
 _sound_esd_Destroy(Sample * s)
 {
-   if (!s)
-      return;
-
    if (s->id && sound_fd >= 0)
      {
 /*      Why the hell is this symbol not in esd? */
@@ -105,14 +102,14 @@ _sound_esd_Destroy(Sample * s)
 /*      esd_sample_kill(sound_fd,s->id); */
        esd_sample_free(sound_fd, s->id);
      }
-   EFREE_NULL(s->ssd.data);
+   Efree(s->ssd.data);
    Efree(s);
 }
 
 static void
 _sound_esd_Play(Sample * s)
 {
-   if (sound_fd < 0 || !s)
+   if (sound_fd < 0)
       return;
 
    if (s->id > 0)
diff --git a/src/sound_pa.c b/src/sound_pa.c
index 7814a7fd..0944425e 100644
--- a/src/sound_pa.c
+++ b/src/sound_pa.c
@@ -182,9 +182,7 @@ _sound_pa_Destroy(Sample * s)
 {
    pa_operation       *op;
 
-   D2printf("%s beg: %s\n", __func__, s ? s->name : "?");
-   if (!s)
-      return;
+   D2printf("%s beg: %s\n", __func__, s->name);
 
    if (pa_ctx && s->name)
      {
@@ -196,8 +194,8 @@ _sound_pa_Destroy(Sample * s)
      }
    D2printf("%s end\n", __func__);
 
-   EFREE_NULL(s->name);
-   EFREE_NULL(s->ssd.data);
+   Efree(s->name);
+   Efree(s->ssd.data);
    Efree(s);
 }
 
@@ -270,8 +268,8 @@ _sound_pa_Play(Sample * s)
 {
    pa_operation       *op;
 
-   D2printf("%s beg: %s\n", __func__, s ? s->name : "?");
-   if (!pa_ctx || !s)
+   D2printf("%s beg: %s\n", __func__, s->name);
+   if (!pa_ctx)
       return;
 
    op = pa_context_play_sample(pa_ctx, s->name, NULL, PA_VOLUME_NORM,
diff --git a/src/sound_sndio.c b/src/sound_sndio.c
index 0155818b..39ac7997 100644
--- a/src/sound_sndio.c
+++ b/src/sound_sndio.c
@@ -63,10 +63,7 @@ _sound_sndio_Load(const char *file)
 static void
 _sound_sndio_Destroy(Sample * s)
 {
-   if (!s)
-      return;
-
-   EFREE_NULL(s->ssd.data);
+   Efree(s->ssd.data);
    Efree(s);
 }
 
@@ -75,7 +72,7 @@ _sound_sndio_Play(Sample * s)
 {
    struct sio_par      params;
 
-   if (hdl == NULL || !s)
+   if (hdl == NULL)
       return;
 
    sio_initpar(&params);

-- 


Reply via email to