[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117628: Make compare-strings more compatible with o
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] trunk r117628: Make compare-strings more compatible with old behavior. |
Date: |
Sat, 02 Aug 2014 15:56:31 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117628
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/17903
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2014-08-02 08:56:18 -0700
message:
Make compare-strings more compatible with old behavior.
* fns.c (Fcompare_strings): Silently bring too-large ends into range.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/fns.c fns.c-20091113204419-o5vbwnq5f7feedwu-203
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-08-02 13:32:40 +0000
+++ b/src/ChangeLog 2014-08-02 15:56:18 +0000
@@ -1,3 +1,8 @@
+2014-08-02 Paul Eggert <address@hidden>
+
+ Make compare-strings more compatible with old behavior (Bug#17903).
+ * fns.c (Fcompare_strings): Silently bring too-large ends into range.
+
2014-08-02 Jan Djärv <address@hidden>
* gtkutil.c (create_dialog): Force min spacing 10 between buttons.
=== modified file 'src/fns.c'
--- a/src/fns.c 2014-07-26 13:17:25 +0000
+++ b/src/fns.c 2014-08-02 15:56:18 +0000
@@ -253,6 +253,13 @@
CHECK_STRING (str1);
CHECK_STRING (str2);
+ /* For backward compatibility, silently bring too-large positive end
+ values into range. */
+ if (INTEGERP (end1) && SCHARS (str1) < XINT (end1))
+ end1 = make_number (SCHARS (str1));
+ if (INTEGERP (end2) && SCHARS (str2) < XINT (end2))
+ end2 = make_number (SCHARS (str2));
+
validate_subarray (str1, start1, end1, SCHARS (str1), &from1, &to1);
validate_subarray (str2, start2, end2, SCHARS (str2), &from2, &to2);
@@ -1720,7 +1727,7 @@
else if (VECTORP (seq))
{
ptrdiff_t i, size = ASIZE (seq);
-
+
new = make_uninit_vector (size);
for (i = 0; i < size; i++)
ASET (new, i, AREF (seq, size - i - 1));
@@ -1737,7 +1744,7 @@
else if (STRINGP (seq))
{
ptrdiff_t size = SCHARS (seq), bytes = SBYTES (seq);
-
+
if (size == bytes)
{
ptrdiff_t i;
@@ -1755,7 +1762,7 @@
while (q > SDATA (new))
{
int ch, len;
-
+
ch = STRING_CHAR_AND_LENGTH (p, len);
p += len, q -= len;
CHAR_STRING (ch, q);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117628: Make compare-strings more compatible with old behavior.,
Paul Eggert <=