[balsa/69-resend-message: 16/16] send: Use g_set_object() to simplify the code




commit e747080609f28bfc1fdf4b96b3e1152be9db420c
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Mar 6 08:10:11 2022 -0500

    send: Use g_set_object() to simplify the code

 libbalsa/send.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/libbalsa/send.c b/libbalsa/send.c
index 50bf3a3f1..deabfd204 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -727,7 +727,7 @@ lbs_process_queue_msg(guint                    msgno,
        } else {
                 gboolean request_dsn;
                 LibBalsaMessageHeaders *headers;
-                InternetAddressList *from;
+                InternetAddressList *from = NULL;
                const InternetAddress* ia;
                const gchar* mailbox;
                const gchar* resent_from;
@@ -745,13 +745,10 @@ lbs_process_queue_msg(guint                  msgno,
                /* Add the sender info */
                 resent_from = libbalsa_message_get_user_header(msg, "Resent-From");
                headers = libbalsa_message_get_headers(msg);
-                if (resent_from != NULL) {
+                if (resent_from != NULL)
                     from = internet_address_list_parse(libbalsa_parser_options(), resent_from);
-                } else {
-                    from = headers->from;
-                    if (from != NULL)
-                        g_object_ref(from);
-                }
+                else
+                    g_set_object(&from, headers->from);
 
                if (from != NULL &&
                     (ia = internet_address_list_get_address(from, 0)) != NULL) {
@@ -766,8 +763,7 @@ lbs_process_queue_msg(guint                    msgno,
 
                net_client_smtp_msg_set_sender(new_message->smtp_msg, mailbox);
 
-                if (from != NULL)
-                    g_object_unref(from);
+                g_set_object(&from, NULL);
 
                /* Now need to add the recipients to the message. */
                 if (resent_from != NULL) {


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