[balsa] Port your module from g_memdup() to g_memdup2()



commit 4b69f74fc192b0ea24e46d341991de4bab6dcb07
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu Feb 4 19:15:46 2021 -0500

    Port your module from g_memdup() to g_memdup2()
    
    https://discourse.gnome.org/t/port-your-module-from-g-memdup-to-g-memdup2-now/5538
    
    modified:   libbalsa/mailbox_mbox.c

 libbalsa/mailbox_mbox.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/libbalsa/mailbox_mbox.c b/libbalsa/mailbox_mbox.c
index f663d5f17..e723bf86e 100644
--- a/libbalsa/mailbox_mbox.c
+++ b/libbalsa/mailbox_mbox.c
@@ -496,8 +496,11 @@ parse_mailbox(LibBalsaMailboxMbox * mbox)
             continue;
 
         msg_info.local_info.flags = msg_info.orig_flags;
-        g_ptr_array_add(mbox->msgno_2_msg_info,
-                        g_memdup(&msg_info, sizeof(msg_info)));
+#if GLIB_CHECK_VERSION(2, 67, 3)
+        g_ptr_array_add(mbox->msgno_2_msg_info, g_memdup2(&msg_info, sizeof(msg_info)));
+#else
+        g_ptr_array_add(mbox->msgno_2_msg_info, g_memdup(&msg_info, sizeof(msg_info)));
+#endif
         mbox->messages_info_changed = TRUE;
 
         libbalsa_message_set_flags(msg, msg_info.orig_flags);
@@ -581,8 +584,11 @@ lbm_mbox_restore(LibBalsaMailboxMbox * mbox)
             && !lbm_mbox_seek_to_message(mbox, msg_info->end))
             /* Error: no message following this one. */
             break;
-        g_ptr_array_add(mbox->msgno_2_msg_info,
-                        g_memdup(msg_info, sizeof *msg_info));
+#if GLIB_CHECK_VERSION(2, 67, 3)
+        g_ptr_array_add(mbox->msgno_2_msg_info, g_memdup2(msg_info, sizeof *msg_info));
+#else
+        g_ptr_array_add(mbox->msgno_2_msg_info, g_memdup(msg_info, sizeof *msg_info));
+#endif
     } while (++msg_info < (struct message_info *) (contents + length));
 
     g_debug("%s: %s restored %zd messages", __func__,


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