Ruby Forum Ruby-Gnome 2 > Little compatibility issue with Ruby 1.9 (rb_argv variable)

Posted by Joao Pedrosa (jpedrosa)
on 18.05.2008 23:13
Attachment: rb_argv_ruby_1_9_issue.diff (1,2 KB)
(Received via mailing list)
Hey guys,

Today I was installing things on my newly installed Ubuntu Hardy Heron
system, and I gave Ruby-GNOME2 a try with Ruby 1.9, but
found out some issue, which was fixed as follows (my C is weak so I
had to learn on my own that the macro recently introduced in Ruby 1.9
was causing the issue):

Index: gtk/src/rbgtkmain.c
===================================================================
--- gtk/src/rbgtkmain.c  (revisão 3214)
+++ gtk/src/rbgtkmain.c  (cópia de trabalho)
@@ -105,10 +105,8 @@
     rb_scan_args(argc, argv, "01", &argary);

     if (NIL_P(argary)){
-        VALUE rb_argv;
-        rb_argv = rb_const_get(rb_cObject, rb_intern("ARGV"));
-        gargc = RARRAY(rb_argv)->len;
-        argary = rb_argv;
+        argary = rb_const_get(rb_cObject, rb_intern("ARGV"));
+        gargc = RARRAY(argary)->len;
     } else {
         Check_Type(argary, T_ARRAY);
         gargc = RARRAY(argary)->len;
Index: gstreamer/src/rbgst.c
===================================================================
--- gstreamer/src/rbgst.c  (revisão 3214)
+++ gstreamer/src/rbgst.c  (cópia de trabalho)
@@ -163,10 +163,8 @@
     rb_scan_args (argc, argv, "01", &argary);

     if (NIL_P (argary)) {
-  VALUE rb_argv;
-        rb_argv = rb_const_get(rb_cObject, rb_intern("ARGV"));
-        gargc = RARRAY(rb_argv)->len;
-        argary = rb_argv;
+        argary = rb_const_get(rb_cObject, rb_intern("ARGV"));
+        gargc = RARRAY(argary)->len;
     } else {
         Check_Type (argary, T_ARRAY);
         gargc = RARRAY (argary)->len;



That is, rb_argv was probably being replaced with a function
(rb_get_argv) or something. The fix
was just to make use of the already available argary variable sooner.

Thanks for the continued work on this great project!

Cheers,
Joao
Posted by Kouhei Sutou (Guest)
on 20.05.2008 16:28
(Received via mailing list)
Hi,

In <ca2428780805181412p3e62d4b2ka6bef7ee649d433f@mail.gmail.com>
  "[ruby-gnome2-devel-en] Little compatibility issue with Ruby 1.9 
(rb_argv variable)" on Sun, 18 May 2008 18:12:24 -0300,
  "Joao Pedrosa" <joaopedrosa@gmail.com> wrote:

> Today I was installing things on my newly installed Ubuntu Hardy Heron
> system, and I gave Ruby-GNOME2 a try with Ruby 1.9, but
> found out some issue, which was fixed as follows (my C is weak so I
> had to learn on my own that the macro recently introduced in Ruby 1.9
> was causing the issue):

Thanks.
I've applied your patch.

--
kou