mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Emergency fix for Ruby problems
With optimizations enabled "alloca(len)" generates code which depends on "len > 0". If "len == 0" then the stack pointer becomes botched. This fix simply avoids a call to "alloca(len)" in the latter case. The root of this problem may be deeper than this, hence I am calling this an "emergency fix" for now but at least it fixes the crashes in the Ruby interface that appear when compiling on Mac OS X 10.7.
This commit is contained in:
+8
-5
@@ -765,11 +765,14 @@ static VALUE vim_message(VALUE self UNUSED, VALUE str)
|
||||
char *buff, *p;
|
||||
|
||||
str = rb_obj_as_string(str);
|
||||
buff = ALLOCA_N(char, RSTRING_LEN(str));
|
||||
strcpy(buff, RSTRING_PTR(str));
|
||||
p = strchr(buff, '\n');
|
||||
if (p) *p = '\0';
|
||||
MSG(buff);
|
||||
if (RSTRING_LEN(str) > 0)
|
||||
{
|
||||
buff = ALLOCA_N(char, RSTRING_LEN(str));
|
||||
strcpy(buff, RSTRING_PTR(str));
|
||||
p = strchr(buff, '\n');
|
||||
if (p) *p = '\0';
|
||||
MSG(buff);
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user