diff options
| author | Paul Eggert | 2014-08-02 08:56:18 -0700 |
|---|---|---|
| committer | Paul Eggert | 2014-08-02 08:56:18 -0700 |
| commit | cb8b23675e088b0c3ba6dce8d6a0b085324f04f3 (patch) | |
| tree | e786f9bbf5a9ff4bf0dcc1993a0a4b2b3b1337c1 /src | |
| parent | f5f3247c658646381a00ae94f0ceee143ccd1ba6 (diff) | |
| download | emacs-cb8b23675e088b0c3ba6dce8d6a0b085324f04f3.tar.gz emacs-cb8b23675e088b0c3ba6dce8d6a0b085324f04f3.zip | |
Make compare-strings more compatible with old behavior.
* fns.c (Fcompare_strings): Silently bring too-large ends into range.
Fixes: debbugs:17903
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/fns.c | 13 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8ffc1c56675..0125f4c93e2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-08-02 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Make compare-strings more compatible with old behavior (Bug#17903). | ||
| 4 | * fns.c (Fcompare_strings): Silently bring too-large ends into range. | ||
| 5 | |||
| 1 | 2014-08-02 Jan Djärv <jan.h.d@swipnet.se> | 6 | 2014-08-02 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 7 | ||
| 3 | * gtkutil.c (create_dialog): Force min spacing 10 between buttons. | 8 | * gtkutil.c (create_dialog): Force min spacing 10 between buttons. |
| @@ -253,6 +253,13 @@ If string STR1 is greater, the value is a positive number N; | |||
| 253 | CHECK_STRING (str1); | 253 | CHECK_STRING (str1); |
| 254 | CHECK_STRING (str2); | 254 | CHECK_STRING (str2); |
| 255 | 255 | ||
| 256 | /* For backward compatibility, silently bring too-large positive end | ||
| 257 | values into range. */ | ||
| 258 | if (INTEGERP (end1) && SCHARS (str1) < XINT (end1)) | ||
| 259 | end1 = make_number (SCHARS (str1)); | ||
| 260 | if (INTEGERP (end2) && SCHARS (str2) < XINT (end2)) | ||
| 261 | end2 = make_number (SCHARS (str2)); | ||
| 262 | |||
| 256 | validate_subarray (str1, start1, end1, SCHARS (str1), &from1, &to1); | 263 | validate_subarray (str1, start1, end1, SCHARS (str1), &from1, &to1); |
| 257 | validate_subarray (str2, start2, end2, SCHARS (str2), &from2, &to2); | 264 | validate_subarray (str2, start2, end2, SCHARS (str2), &from2, &to2); |
| 258 | 265 | ||
| @@ -1720,7 +1727,7 @@ See also the function `nreverse', which is used more often. */) | |||
| 1720 | else if (VECTORP (seq)) | 1727 | else if (VECTORP (seq)) |
| 1721 | { | 1728 | { |
| 1722 | ptrdiff_t i, size = ASIZE (seq); | 1729 | ptrdiff_t i, size = ASIZE (seq); |
| 1723 | 1730 | ||
| 1724 | new = make_uninit_vector (size); | 1731 | new = make_uninit_vector (size); |
| 1725 | for (i = 0; i < size; i++) | 1732 | for (i = 0; i < size; i++) |
| 1726 | ASET (new, i, AREF (seq, size - i - 1)); | 1733 | ASET (new, i, AREF (seq, size - i - 1)); |
| @@ -1737,7 +1744,7 @@ See also the function `nreverse', which is used more often. */) | |||
| 1737 | else if (STRINGP (seq)) | 1744 | else if (STRINGP (seq)) |
| 1738 | { | 1745 | { |
| 1739 | ptrdiff_t size = SCHARS (seq), bytes = SBYTES (seq); | 1746 | ptrdiff_t size = SCHARS (seq), bytes = SBYTES (seq); |
| 1740 | 1747 | ||
| 1741 | if (size == bytes) | 1748 | if (size == bytes) |
| 1742 | { | 1749 | { |
| 1743 | ptrdiff_t i; | 1750 | ptrdiff_t i; |
| @@ -1755,7 +1762,7 @@ See also the function `nreverse', which is used more often. */) | |||
| 1755 | while (q > SDATA (new)) | 1762 | while (q > SDATA (new)) |
| 1756 | { | 1763 | { |
| 1757 | int ch, len; | 1764 | int ch, len; |
| 1758 | 1765 | ||
| 1759 | ch = STRING_CHAR_AND_LENGTH (p, len); | 1766 | ch = STRING_CHAR_AND_LENGTH (p, len); |
| 1760 | p += len, q -= len; | 1767 | p += len, q -= len; |
| 1761 | CHAR_STRING (ch, q); | 1768 | CHAR_STRING (ch, q); |