[balsa/wip/gtk4: 151/351] mailbox: Assign MailboxView structure explicitly



commit ce05b6fa0010569fb5f4322f3029e85765866593
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Feb 7 18:43:35 2018 -0500

    mailbox: Assign MailboxView structure explicitly
    
    The scan-build tool doesn't recognize g_memdup() as initializing the
    newly allocated memory. Allocating it and then explicitly initializing
    it by assignment is accepted, and probably generates about the same
    code.

 libbalsa/mailbox.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/libbalsa/mailbox.c b/libbalsa/mailbox.c
index 9bf3181..f386e36 100644
--- a/libbalsa/mailbox.c
+++ b/libbalsa/mailbox.c
@@ -2280,8 +2280,8 @@ libbalsa_mailbox_view_new(void)
 {
     LibBalsaMailboxView *view;
 
-    view = g_memdup(&libbalsa_mailbox_view_default,
-                   sizeof libbalsa_mailbox_view_default);
+    view = g_new(LibBalsaMailboxView, 1);
+    *view = libbalsa_mailbox_view_default;
 
     return view;
 }


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