[vala] Revert "glib-2.0: Map given end == 0 for string.slice/splice() to string.length"



commit e66d2192a9d5d816964d898eea8d09123c289ee4
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun May 24 14:15:38 2020 +0200

    Revert "glib-2.0: Map given end == 0 for string.slice/splice() to string.length"
    
    This reverts commit f844ad1c02fb5b17e923a7ba4e69cf2a7df96a14.

 tests/basic-types/strings.vala | 12 ------------
 vapi/glib-2.0.vapi             |  4 ----
 2 files changed, 16 deletions(-)
---
diff --git a/tests/basic-types/strings.vala b/tests/basic-types/strings.vala
index 7ae03ef97..a4fcda4f7 100644
--- a/tests/basic-types/strings.vala
+++ b/tests/basic-types/strings.vala
@@ -70,12 +70,6 @@ void test_string_slice () {
 
        r = s.slice (-7, -5);
        assert (r == "my");
-
-       r = s.slice (-7, 0);
-       assert (r == "myworld");
-
-       r = s.slice (5, 0);
-       assert (r == "myworld");
 }
 
 void test_string_splice () {
@@ -95,12 +89,6 @@ void test_string_splice () {
 
        s = s.splice (-14, -5);
        assert (s == "helloworld");
-
-       s = s.splice (-5, 0, "wide");
-       assert (s == "hellowide");
-
-       s = s.splice (5, 0, "world");
-       assert (s == "helloworld");
 }
 
 void test_string_substring () {
diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index 4da3873b6..c3df0f7ec 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -1484,8 +1484,6 @@ public class string {
                }
                if (end < 0) {
                        end = string_length + end;
-               } else if (end == 0) {
-                       end = string_length;
                }
                GLib.return_val_if_fail (start >= 0 && start <= string_length, null);
                GLib.return_val_if_fail (end >= 0 && end <= string_length, null);
@@ -1500,8 +1498,6 @@ public class string {
                }
                if (end < 0) {
                        end = string_length + end;
-               } else if (end == 0) {
-                       end = string_length;
                }
                GLib.return_val_if_fail (start >= 0 && start <= string_length, null);
                GLib.return_val_if_fail (end >= 0 && end <= string_length, null);


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