Created
March 4, 2012 01:38
-
-
Save h3xx/1969801 to your computer and use it in GitHub Desktop.
Patch to fix elinks to work with Ruby 1.9.1+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ru elinks.orig/src/scripting/ruby/core.c elinks/src/scripting/ruby/core.c | |
--- elinks.orig/src/scripting/ruby/core.c 2009-12-04 21:47:38.000000000 -0600 | |
+++ elinks/src/scripting/ruby/core.c 2009-12-04 21:41:43.000000000 -0600 | |
@@ -76,10 +76,10 @@ | |
break; | |
case TAG_RAISE: | |
case TAG_FATAL: | |
- eclass = CLASS_OF(ruby_errinfo); | |
- einfo = rb_obj_as_string(ruby_errinfo); | |
+ eclass = CLASS_OF(rb_errinfo); | |
+ einfo = rb_obj_as_string(rb_errinfo); | |
- if (eclass == rb_eRuntimeError && RSTRING(einfo)->len == 0) { | |
+ if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) { | |
msg = "unhandled exception"; | |
} else { | |
@@ -88,7 +88,7 @@ | |
epath = rb_class_path(eclass); | |
snprintf(buff, MAX_STR_LEN, "%s: %s", | |
- RSTRING(epath)->ptr, RSTRING(einfo)->ptr); | |
+ RSTRING_PTR(epath), RSTRING_PTR(einfo)); | |
p = strchr(buff, '\n'); | |
if (p) *p = '\0'; | |
@@ -116,7 +116,7 @@ | |
struct terminal *term; | |
str = rb_obj_as_string(str); | |
- message = memacpy(RSTRING(str)->ptr, RSTRING(str)->len); | |
+ message = memacpy(RSTRING_PTR(str), RSTRING_LEN(str)); | |
if (!message) return Qnil; | |
line_end = strchr(message, '\n'); | |
@@ -165,8 +165,8 @@ | |
* the inspect() method, which adds quotes to the strings, so | |
* gently ignore them. */ | |
- ptr = RSTRING(substr)->ptr; | |
- len = RSTRING(substr)->len; | |
+ ptr = RSTRING_PTR(substr); | |
+ len = RSTRING_LEN(substr); | |
if (*ptr == '"') | |
ptr++, len--; | |
diff -ru elinks.orig/src/scripting/ruby/hooks.c elinks/src/scripting/ruby/hooks.c | |
--- elinks.orig/src/scripting/ruby/hooks.c 2009-12-04 21:47:38.000000000 -0600 | |
+++ elinks/src/scripting/ruby/hooks.c 2009-12-04 21:37:41.000000000 -0600 | |
@@ -83,7 +83,7 @@ | |
{ | |
unsigned char *new_url; | |
- new_url = memacpy(RSTRING(result)->ptr, RSTRING(result)->len); | |
+ new_url = memacpy(RSTRING_PTR(result), RSTRING_LEN(result)); | |
if (new_url) { | |
mem_free_set(url, new_url); | |
} | |
@@ -126,7 +126,7 @@ | |
{ | |
unsigned char *new_url; | |
- new_url = memacpy(RSTRING(result)->ptr, RSTRING(result)->len); | |
+ new_url = memacpy(RSTRING_PTR(result), RSTRING_LEN(result)); | |
if (new_url) { | |
mem_free_set(url, new_url); | |
} | |
@@ -170,9 +170,9 @@ | |
switch (rb_type(result)) { | |
case T_STRING: | |
{ | |
- int len = RSTRING(result)->len; | |
+ int len = RSTRING_LEN(result); | |
- add_fragment(cached, 0, RSTRING(result)->ptr, len); | |
+ add_fragment(cached, 0, RSTRING_PTR(result), len); | |
normalize_cache_entry(cached, len); | |
break; | |
@@ -216,7 +216,7 @@ | |
{ | |
unsigned char *proxy; | |
- proxy = memacpy(RSTRING(result)->ptr, RSTRING(result)->len); | |
+ proxy = memacpy(RSTRING_PTR(result), RSTRING_LEN(result)); | |
if (proxy) { | |
mem_free_set(new_proxy_url, proxy); | |
} | |
diff --git a/config/m4/ruby.m4 b/config/m4/ruby.m4 | |
index 3983920..4659025 100644 | |
--- a/config/m4/ruby.m4 | |
+++ b/config/m4/ruby.m4 | |
@@ -32,12 +32,12 @@ if test "$CONFIG_SCRIPTING_RUBY" = "yes"; then | |
if test "$CONFIG_SCRIPTING_RUBY" != "no"; then | |
AC_MSG_CHECKING(Ruby version) | |
- if $CONFIG_SCRIPTING_RUBY -e 'exit((VERSION or RUBY_VERSION) >= "1.6.0")' >/dev/null 2>/dev/null; then | |
+ if $CONFIG_SCRIPTING_RUBY -e 'exit((RUBY_VERSION) >= "1.6.0")' >/dev/null 2>/dev/null; then | |
ruby_version=`$CONFIG_SCRIPTING_RUBY -e 'puts "#{VERSION rescue RUBY_VERSION}"'` | |
AC_MSG_RESULT($ruby_version) | |
AC_MSG_CHECKING(for Ruby header files) | |
- rubyhdrdir=`$CONFIG_SCRIPTING_RUBY -r mkmf -e 'print Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null` | |
+ rubyhdrdir=`$CONFIG_SCRIPTING_RUBY -r mkmf -e 'print Config::CONFIG[["hdrdir"]] || $hdrdir' 2>/dev/null` | |
if test "X$rubyhdrdir" != "X"; then | |
AC_MSG_RESULT($rubyhdrdir) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment