[libgee] Replace Memory.dup() with GLib.malloc() and Memory.copy()



commit 63d2b88e2652606b0571ff94c620949a6969b1fb
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Feb 5 16:25:11 2021 +0100

    Replace Memory.dup() with GLib.malloc() and Memory.copy()

 gee/Makefile.am  | 1 +
 gee/timsort.vala | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gee/Makefile.am b/gee/Makefile.am
index 42e0a89..5634bcb 100644
--- a/gee/Makefile.am
+++ b/gee/Makefile.am
@@ -121,6 +121,7 @@ libgee_0_8_la_VALAFLAGS = \
        -h gee-internals.h \
        --internal-vapi gee-internals-0.8.vapi \
        --library gee-0.8 --gir Gee-0.8.gir \
+       --vapi-comments \
        --pkg gio-2.0 \
        --vapidir $(top_srcdir)/utils --pkg geeutils \
        $(COVERAGE_VALAFLAGS) \
diff --git a/gee/timsort.vala b/gee/timsort.vala
index d3c5ae9..01710be 100644
--- a/gee/timsort.vala
+++ b/gee/timsort.vala
@@ -655,7 +655,9 @@ internal class Gee.TimSort<G> : Object {
                }
 
                public void copy () {
-                       new_list = Memory.dup (&list[index], (uint) sizeof (G) * length);
+                       size_t size = sizeof (G) * length;
+                       new_list = malloc (size);
+                       Memory.copy (new_list, &list[index], size);
                        list = new_list;
                        index = 0;
                }


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