Compare commits

...

4 Commits

Author SHA1 Message Date
Bram Moolenaar
87ea64ca96 patch 8.1.0237: Ruby on Cygwin doesn't always work
Problem:    Ruby on Cygwin doesn't always work.
Solution:   Use LIBRUBY_SO if LIBRUBY_ALIASES isn't set. (Ken Takata)
2018-08-04 15:13:34 +02:00
Bram Moolenaar
82593c1a3a patch 8.1.0236: Ruby build fails when ruby_intern is missing
Problem:    Ruby build fails when ruby_intern is missing.
Solution:   Do not use ruby_intern2. (Ken Takata)
2018-08-03 22:03:17 +02:00
Bram Moolenaar
3bf5e6a4c8 patch 8.1.0235: more help tags that jump to the wrong location
Problem:    More help tags that jump to the wrong location.
Solution:   Add more exceptions and a table for "expr-" tags. (Hirohito
            Higashi)
2018-08-02 22:23:57 +02:00
Bram Moolenaar
41c363a315 patch 8.1.0234: incorrect reference counting in Perl interface
Problem:    Incorrect reference counting in Perl interface.
Solution:   Call SvREFCNT_inc more often, add a test. (Damien)
2018-08-02 21:46:51 +02:00
8 changed files with 96 additions and 31 deletions

3
src/auto/configure vendored
View File

@@ -7606,6 +7606,9 @@ $as_echo "$rubyhdrdir" >&6; }
if test "$enable_rubyinterp" = "dynamic"; then
libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG['LIBRUBY_ALIASES'].split[0]"`
if test -z "$libruby_soname"; then
libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG['LIBRUBY_SO']"`
fi
$as_echo "#define DYNAMIC_RUBY 1" >>confdefs.h
RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"

View File

@@ -1956,6 +1956,9 @@ if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
AC_DEFINE(FEAT_RUBY)
if test "$enable_rubyinterp" = "dynamic"; then
libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_ALIASES']].split[[0]]"`
if test -z "$libruby_soname"; then
libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_SO']]"`
fi
AC_DEFINE(DYNAMIC_RUBY)
RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
RUBY_LIBS=

View File

@@ -6583,7 +6583,8 @@ find_help_tags(
static char *(mtable[]) = {"*", "g*", "[*", "]*", ":*",
"/*", "/\\*", "\"*", "**",
"cpo-*", "/\\(\\)", "/\\%(\\)",
"?", ":?", "-?", "?<CR>", "g?", "g?g?", "g??",
"?", ":?", "?<CR>", "g?", "g?g?", "g??",
"-?", "q?", "v_g?",
"/\\?", "/\\z(\\)", "\\=", ":s\\=",
"[count]", "[quotex]",
"[range]", ":[range]",
@@ -6593,27 +6594,43 @@ find_help_tags(
static char *(rtable[]) = {"star", "gstar", "[star", "]star", ":star",
"/star", "/\\\\star", "quotestar", "starstar",
"cpo-star", "/\\\\(\\\\)", "/\\\\%(\\\\)",
"?", ":?", "-?", "?<CR>", "g?", "g?g?", "g??",
"?", ":?", "?<CR>", "g?", "g?g?", "g??",
"-?", "q?", "v_g?",
"/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=",
"\\[count]", "\\[quotex]",
"\\[range]", ":\\[range]",
"\\[pattern]", "\\\\bar", "/\\\\%\\$",
"s/\\\\\\~", "s/\\\\U", "s/\\\\L",
"s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"};
static char *(expr_table[]) = {"!=?", "!~?", "<=?", "<?", "==?", "=~?",
">=?", ">?", "is?", "isnot?"};
int flags;
d = IObuff; /* assume IObuff is long enough! */
/*
* Recognize a few exceptions to the rule. Some strings that contain '*'
* with "star". Otherwise '*' is recognized as a wildcard.
*/
for (i = (int)(sizeof(mtable) / sizeof(char *)); --i >= 0; )
if (STRCMP(arg, mtable[i]) == 0)
{
STRCPY(d, rtable[i]);
break;
}
if (STRNICMP(arg, "expr-", 5) == 0)
{
// When the string starting with "expr-" and containing '?' and matches
// the table, it is taken literally. Otherwise '?' is recognized as a
// wildcard.
for (i = (int)(sizeof(expr_table) / sizeof(char *)); --i >= 0; )
if (STRCMP(arg + 5, expr_table[i]) == 0)
{
STRCPY(d, arg);
break;
}
}
else
{
// Recognize a few exceptions to the rule. Some strings that contain
// '*' with "star". Otherwise '*' is recognized as a wildcard.
for (i = (int)(sizeof(mtable) / sizeof(char *)); --i >= 0; )
if (STRCMP(arg, mtable[i]) == 0)
{
STRCPY(d, rtable[i]);
break;
}
}
if (i < 0) /* no match in table */
{

View File

@@ -831,8 +831,7 @@ newWINrv(SV *rv, win_T *ptr)
ptr->w_perl_private = newSV(0);
sv_setiv(ptr->w_perl_private, PTR2IV(ptr));
}
else
SvREFCNT_inc_void_NN(ptr->w_perl_private);
SvREFCNT_inc_void_NN(ptr->w_perl_private);
SvRV(rv) = ptr->w_perl_private;
SvROK_on(rv);
return sv_bless(rv, gv_stashpv("VIWIN", TRUE));
@@ -847,8 +846,7 @@ newBUFrv(SV *rv, buf_T *ptr)
ptr->b_perl_private = newSV(0);
sv_setiv(ptr->b_perl_private, PTR2IV(ptr));
}
else
SvREFCNT_inc_void_NN(ptr->b_perl_private);
SvREFCNT_inc_void_NN(ptr->b_perl_private);
SvRV(rv) = ptr->b_perl_private;
SvROK_on(rv);
return sv_bless(rv, gv_stashpv("VIBUF", TRUE));
@@ -918,12 +916,13 @@ I32 cur_val(IV iv, SV *sv)
else
rv = newBUFrv(newSV(0), curbuf);
if (SvRV(sv) == SvRV(rv))
SvREFCNT_dec(SvRV(rv));
else // XXX: Not sure if the `else` condition are right
// Test_SvREFCNT() pass in all case.
if (SvRV(sv) != SvRV(rv))
// XXX: This magic variable is a bit confusing...
// Is curently refcounted ?
sv_setsv(sv, rv);
SvREFCNT_dec(rv);
return 0;
}
#endif /* !PROTO */

View File

@@ -253,11 +253,12 @@ static void ruby_vim_init(void);
# define rb_hash_new dll_rb_hash_new
# define rb_inspect dll_rb_inspect
# define rb_int2inum dll_rb_int2inum
# ifdef RUBY19_OR_LATER
# define rb_intern2 dll_rb_intern2
# else
# ifndef rb_intern
# define rb_intern dll_rb_intern
# endif
# ifdef RUBY_CONST_ID_CACHE
# define rb_intern2 dll_rb_intern2
# endif
# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG /* 64 bits only */
# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER <= 18
# define rb_fix2int dll_rb_fix2int
@@ -392,10 +393,9 @@ static VALUE (*dll_rb_hash_aset) (VALUE, VALUE, VALUE);
static VALUE (*dll_rb_hash_new) (void);
static VALUE (*dll_rb_inspect) (VALUE);
static VALUE (*dll_rb_int2inum) (long);
# ifdef RUBY19_OR_LATER
static ID (*dll_rb_intern2) (const char*, long);
# else
static ID (*dll_rb_intern) (const char*);
# ifdef RUBY_CONST_ID_CACHE
static ID (*dll_rb_intern2) (const char*, long);
# endif
# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG /* 64 bits only */
static long (*dll_rb_fix2int) (VALUE);
@@ -596,10 +596,9 @@ static struct
{"rb_hash_new", (RUBY_PROC*)&dll_rb_hash_new},
{"rb_inspect", (RUBY_PROC*)&dll_rb_inspect},
{"rb_int2inum", (RUBY_PROC*)&dll_rb_int2inum},
# ifdef RUBY19_OR_LATER
{"rb_intern2", (RUBY_PROC*)&dll_rb_intern2},
# else
{"rb_intern", (RUBY_PROC*)&dll_rb_intern},
# ifdef RUBY_CONST_ID_CACHE
{"rb_intern2", (RUBY_PROC*)&dll_rb_intern2},
# endif
# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG /* 64 bits only */
{"rb_fix2int", (RUBY_PROC*)&dll_rb_fix2int},

View File

@@ -26,11 +26,34 @@ func Test_help_tagjump()
call assert_true(getline('.') =~ '\*:?\*')
helpclose
help q?
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*q?\*')
call assert_true(expand('<cword>') == 'q?')
helpclose
help -?
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*-?\*')
helpclose
help v_g?
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*v_g?\*')
helpclose
help expr-!=?
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*expr-!=?\*')
call assert_true(expand('<cword>') == 'expr-!=?')
helpclose
help expr-isnot?
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*expr-isnot?\*')
call assert_true(expand('<cword>') == 'expr-isnot?')
helpclose
help FileW*Post
call assert_equal("help", &filetype)
call assert_true(getline('.') =~ '\*FileWritePost\*')

View File

@@ -4,6 +4,9 @@ if !has('perl')
finish
end
" FIXME: RunTest don't see any error when Perl abort...
perl $SIG{__WARN__} = sub { die "Unexpected warnings from perl: @_" };
func Test_change_buffer()
call setline(line('$'), ['1 line 1'])
perl VIM::DoCommand("normal /^1\n")
@@ -229,6 +232,15 @@ func Test_000_SvREFCNT()
#line 5 "Test_000_SvREFCNT()"
my ($b, $w);
my $num = 0;
for ( 0 .. 100 ) {
if ( ++$num >= 8 ) { $num = 0 }
VIM::DoCommand("buffer X$num");
$b = $curbuf;
}
VIM::DoCommand("buffer t");
$b = $curbuf for 0 .. 100;
$w = $curwin for 0 .. 100;
() = VIM::Buffers for 0 .. 100;
@@ -240,12 +252,13 @@ func Test_000_SvREFCNT()
my $cw = Internals::SvREFCNT($$w);
VIM::Eval("assert_equal(2, $cb, 'T1')");
VIM::Eval("assert_equal(2, $cw, 'T2')");
my $strongref;
foreach ( VIM::Buffers, VIM::Windows ) {
VIM::DoCommand("%bw!");
my $c = Internals::SvREFCNT($_);
VIM::Eval("assert_equal(2, $c, 'T3')");
$c = Internals::SvREFCNT($$_);
# Why only one ref?
# Look wrong but work. Maybe not portable...
next if $c == 2 && !$strongref++;
VIM::Eval("assert_equal(1, $c, 'T4')");
}
$cb = Internals::SvREFCNT($$curbuf);

View File

@@ -794,6 +794,14 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
237,
/**/
236,
/**/
235,
/**/
234,
/**/
233,
/**/