- patchlevel 411
This commit is contained in:
parent
05c6b5e417
commit
d54068ca44
111
7.4.411
Normal file
111
7.4.411
Normal file
@ -0,0 +1,111 @@
|
||||
To: vim_dev@googlegroups.com
|
||||
Subject: Patch 7.4.411
|
||||
Fcc: outbox
|
||||
From: Bram Moolenaar <Bram@moolenaar.net>
|
||||
Mime-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
------------
|
||||
|
||||
Patch 7.4.411
|
||||
Problem: "foo bar" sorts before "foo" with sort(). (John Little)
|
||||
Solution: Avoid putting quotes around strings before comparing them.
|
||||
Files: src/eval.c
|
||||
|
||||
|
||||
*** ../vim-7.4.410/src/eval.c 2014-08-06 14:52:05.043236174 +0200
|
||||
--- src/eval.c 2014-08-22 13:08:52.423905619 +0200
|
||||
***************
|
||||
*** 17382,17397 ****
|
||||
const void *s2;
|
||||
{
|
||||
sortItem_T *si1, *si2;
|
||||
char_u *p1, *p2;
|
||||
! char_u *tofree1, *tofree2;
|
||||
int res;
|
||||
char_u numbuf1[NUMBUFLEN];
|
||||
char_u numbuf2[NUMBUFLEN];
|
||||
|
||||
si1 = (sortItem_T *)s1;
|
||||
si2 = (sortItem_T *)s2;
|
||||
! p1 = tv2string(&si1->item->li_tv, &tofree1, numbuf1, 0);
|
||||
! p2 = tv2string(&si2->item->li_tv, &tofree2, numbuf2, 0);
|
||||
if (p1 == NULL)
|
||||
p1 = (char_u *)"";
|
||||
if (p2 == NULL)
|
||||
--- 17382,17419 ----
|
||||
const void *s2;
|
||||
{
|
||||
sortItem_T *si1, *si2;
|
||||
+ typval_T *tv1, *tv2;
|
||||
char_u *p1, *p2;
|
||||
! char_u *tofree1 = NULL, *tofree2 = NULL;
|
||||
int res;
|
||||
char_u numbuf1[NUMBUFLEN];
|
||||
char_u numbuf2[NUMBUFLEN];
|
||||
|
||||
si1 = (sortItem_T *)s1;
|
||||
si2 = (sortItem_T *)s2;
|
||||
! tv1 = &si1->item->li_tv;
|
||||
! tv2 = &si2->item->li_tv;
|
||||
! /* tv2string() puts quotes around a string and allocates memory. Don't do
|
||||
! * that for string variables. Use a single quote when comparing with a
|
||||
! * non-string to do what the docs promise. */
|
||||
! if (tv1->v_type == VAR_STRING)
|
||||
! {
|
||||
! if (tv2->v_type != VAR_STRING || item_compare_numeric)
|
||||
! p1 = (char_u *)"'";
|
||||
! else
|
||||
! p1 = tv1->vval.v_string;
|
||||
! }
|
||||
! else
|
||||
! p1 = tv2string(tv1, &tofree1, numbuf1, 0);
|
||||
! if (tv2->v_type == VAR_STRING)
|
||||
! {
|
||||
! if (tv1->v_type != VAR_STRING || item_compare_numeric)
|
||||
! p2 = (char_u *)"'";
|
||||
! else
|
||||
! p2 = tv2->vval.v_string;
|
||||
! }
|
||||
! else
|
||||
! p2 = tv2string(tv2, &tofree2, numbuf2, 0);
|
||||
if (p1 == NULL)
|
||||
p1 = (char_u *)"";
|
||||
if (p2 == NULL)
|
||||
***************
|
||||
*** 17411,17418 ****
|
||||
res = n1 == n2 ? 0 : n1 > n2 ? 1 : -1;
|
||||
}
|
||||
|
||||
! /* When the result would be zero, compare the pointers themselves. Makes
|
||||
! * the sort stable. */
|
||||
if (res == 0 && !item_compare_keep_zero)
|
||||
res = si1->idx > si2->idx ? 1 : -1;
|
||||
|
||||
--- 17433,17440 ----
|
||||
res = n1 == n2 ? 0 : n1 > n2 ? 1 : -1;
|
||||
}
|
||||
|
||||
! /* When the result would be zero, compare the item indexes. Makes the
|
||||
! * sort stable. */
|
||||
if (res == 0 && !item_compare_keep_zero)
|
||||
res = si1->idx > si2->idx ? 1 : -1;
|
||||
|
||||
*** ../vim-7.4.410/src/version.c 2014-08-17 17:24:03.967017727 +0200
|
||||
--- src/version.c 2014-08-22 12:51:35.011943243 +0200
|
||||
***************
|
||||
*** 743,744 ****
|
||||
--- 743,746 ----
|
||||
{ /* Add new patch number below this line */
|
||||
+ /**/
|
||||
+ 411,
|
||||
/**/
|
||||
|
||||
--
|
||||
I started out with nothing, and I still have most of it.
|
||||
-- Michael Davis -- "Tonight Show"
|
||||
|
||||
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
||||
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
||||
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
||||
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
Loading…
Reference in New Issue
Block a user