File: port-to-ruby2.1.patch

package info (click to toggle)
ruby-gd 0.8.0-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 740 kB
  • sloc: ansic: 2,177; ruby: 226; makefile: 3
file content (41 lines) | stat: -rw-r--r-- 861 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From: Antonio Terceiro <terceiro@debian.org>
Date: Tue, 15 Apr 2014 19:43:24 -0300
Subject: Port to Ruby 2.1 and 3.x
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

Fix error:
GD.c:1725:25: error: assignment of read-only member ‘klass’

Forwarded: not-possible
Last-Update: 2021-10-31
---
 GD.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/GD.c b/GD.c
index d019b21..bfdc867 100644
--- a/GD.c
+++ b/GD.c
@@ -1711,13 +1711,20 @@ img_wbmp(img, fg, out)
  *
  */
 
+#include <ruby/version.h>
+
 static VALUE
 ply_new(klass)
     VALUE klass;
 {
     VALUE self = rb_ary_new();
 
+    #if (RUBY_API_VERSION_MAJOR >= 3) || ((RUBY_API_VERSION_MAJOR >= 2) && (RUBY_API_VERSION_MINOR >= 1))
+    rb_obj_reveal(self, klass);
+    #else
     RBASIC(self)->klass = klass;
+    #endif
+
     return self;
 }