[cairo-commit] rcairo/src rb_cairo_private.h, 1.4, 1.5 rb_cairo_surface.c, 1.12, 1.13
Kouhei Sutou
commit at pdx.freedesktop.org
Thu Jun 14 05:23:58 PDT 2007
Committed by: kou
Update of /cvs/cairo/rcairo/src
In directory kemper:/tmp/cvs-serv28502/src
Modified Files:
rb_cairo_private.h rb_cairo_surface.c
Log Message:
* extconf.rb, src/rb_cairo_surface.c, src/rb_cairo_private.h: used
rb_errinfo() and RSTRING_LEN() if available for supporting ruby
1.9. Thanks to Paul van Tilburg!!!
Index: rb_cairo_private.h
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_private.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- rb_cairo_private.h 18 May 2007 14:07:48 -0000 1.4
+++ rb_cairo_private.h 14 Jun 2007 12:23:45 -0000 1.5
@@ -23,6 +23,16 @@
#define CBOOL2RVAL(bool) (bool ? Qtrue : Qfalse)
#define RVAL2CBOOL(bool) RTEST(bool)
+#ifndef RSTRING_LEN
+# define RSTRING_LEN(string) (RSTRING(string)->len)
+#endif
+
+#ifdef HAVE_RB_ERRINFO
+# define RB_ERRINFO (rb_errinfo())
+#else
+# define RB_ERRINFO (ruby_errinfo)
+#endif
+
extern void Init_cairo_private (void);
extern void Init_cairo_constants (void);
Index: rb_cairo_surface.c
===================================================================
RCS file: /cvs/cairo/rcairo/src/rb_cairo_surface.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- rb_cairo_surface.c 20 May 2007 23:31:57 -0000 1.12
+++ rb_cairo_surface.c 14 Jun 2007 12:23:45 -0000 1.13
@@ -115,7 +115,7 @@
{
cr_io_callback_closure_t *closure;
closure = (cr_io_callback_closure_t *)io_closure;
- closure->error = ruby_errinfo;
+ closure->error = RB_ERRINFO;
return Qnil;
}
@@ -133,13 +133,13 @@
output = closure->target;
data = rb_str_new ((const char *)closure->data, closure->length);
- length = RSTRING (data)->len;
+ length = RSTRING_LEN (data);
while (length != 0)
{
VALUE rb_written_bytes = rb_funcall (output, cr_id_write, 1, data);
written_bytes = NUM2LONG (rb_written_bytes);
data = rb_str_substr (data, written_bytes,
- RSTRING (data)->len - written_bytes);
+ RSTRING_LEN (data) - written_bytes);
length -= written_bytes;
}
@@ -180,7 +180,7 @@
result = rb_str_new2 ("");
- for (rest = length; rest != 0; rest = length - RSTRING (result)->len)
+ for (rest = length; rest != 0; rest = length - RSTRING_LEN (result))
{
rb_str_concat (result, rb_funcall (input, cr_id_read, 1, INT2NUM (rest)));
}
More information about the cairo-commit
mailing list