]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
glib-2.0: Make Bytes.slice() use the memory-efficient Bytes.from_bytes() 27099feb6b3c6d5c41dfe3927c0084ecb6fa50ba
authorRico Tzschichholz <ricotz@ubuntu.com>
Fri, 8 Jun 2018 05:19:59 +0000 (07:19 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 10 Jun 2018 11:07:22 +0000 (13:07 +0200)
Fixes https://gitlab.gnome.org/GNOME/vala/issues/638

vapi/glib-2.0.vapi

index 65c5bd755b4f5312ac9fb390855c459dfb58f3dc..903089c9911a7cc1e8968489fbc5c6e4661035cd 100644 (file)
@@ -5053,9 +5053,8 @@ namespace GLib {
                }
 
                [CCode (cname = "_vala_g_bytes_slice")]
-               public GLib.Bytes slice (int start, int end) {
-                       unowned uint8[] data = this.get_data ();
-                       return new GLib.Bytes (data[start:end]);
+               public GLib.Bytes slice (size_t start, size_t end) {
+                       return new GLib.Bytes.from_bytes (this, start, end - start);
                }
 
                public int length {