[libdmapsharing] Adjust use of functions which might set GError *



commit 88e7aa01250bd9f5d1b02da4eec1e7e92cf9479e
Author: W. Michael Petullo <mike flyn org>
Date:   Sun Jun 24 17:14:04 2018 -0400

    Adjust use of functions which might set GError *
    
    Signed-off-by: W. Michael Petullo <mike flyn org>

 libdmapsharing/dmap-av-connection.c    | 3 +--
 libdmapsharing/dmap-image-connection.c | 5 ++---
 libdmapsharing/dmap-share.c            | 8 ++++----
 3 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/libdmapsharing/dmap-av-connection.c b/libdmapsharing/dmap-av-connection.c
index 683ccfd..b483378 100644
--- a/libdmapsharing/dmap-av-connection.c
+++ b/libdmapsharing/dmap-av-connection.c
@@ -127,10 +127,9 @@ _handle_mlcl (DmapConnection * connection, DmapRecordFactory * factory,
        record = dmap_record_factory_create (factory, NULL, &error);
        if (NULL != error) {
                g_signal_emit_by_name (connection, "error", error);
-       }
-       if (record == NULL) {
                goto done;
        }
+       g_assert(NULL != record);
 
        /*
         * We do not free the dynamically-allocated properties
diff --git a/libdmapsharing/dmap-image-connection.c b/libdmapsharing/dmap-image-connection.c
index 35dae74..508f082 100644
--- a/libdmapsharing/dmap-image-connection.c
+++ b/libdmapsharing/dmap-image-connection.c
@@ -116,10 +116,9 @@ _handle_mlcl (DmapConnection * connection, DmapRecordFactory * factory,
        record = dmap_record_factory_create (factory, NULL, &error);
        if (NULL != error) {
                g_signal_emit_by_name (connection, "error", error);
+               goto done;
        }
-       if (record == NULL) {
-               goto _return;
-       }
+       g_assert(NULL != record);
 
        if (filesize) {
                ptr = g_array_sized_new (FALSE, FALSE, 1, filesize);
diff --git a/libdmapsharing/dmap-share.c b/libdmapsharing/dmap-share.c
index 20e0481..142cb4a 100644
--- a/libdmapsharing/dmap-share.c
+++ b/libdmapsharing/dmap-share.c
@@ -409,12 +409,12 @@ _restart (DmapShare * share)
        res = dmap_share_serve (share, &error);
        if (NULL != error) {
                g_signal_emit (share, _signals[ERROR], 0, error);
-       }
-       if (res) {
+               _publish_stop (share);
+       } else {
+               g_assert(FALSE != res);
+
                /* To update information just publish again */
                dmap_share_publish (share, NULL);
-       } else {
-               _publish_stop (share);
        }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]