File: port-to-newer-ruby.patch

package info (click to toggle)
ruby-fusefs 0.7.0-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 372 kB
  • sloc: ansic: 1,141; ruby: 760; sh: 10; makefile: 2
file content (75 lines) | stat: -rw-r--r-- 2,227 bytes parent folder | download | duplicates (4)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Description: port to Ruby 1.9.1 and 2.0
 add also some missing headers and fix a typo
Author: Cédric Boutillier <boutil@debian.org>
Origin: vendor
Forwarded: https://github.com/duairc/fusefs/pull/4
Last-Update: 2013-12-20

--- a/ext/fusefs_lib.c
+++ b/ext/fusefs_lib.c
@@ -17,6 +17,8 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <ruby.h>
+#include <unistd.h>
+#include <ctype.h>
 
 #ifdef DEBUG
 #include <stdarg.h>
@@ -452,7 +454,7 @@
     if (TYPE(cur_entry) != T_STRING)
       continue;
 
-    filler(buf,STR2CSTR(cur_entry),NULL,0);
+    filler(buf,StringValuePtr(cur_entry),NULL,0);
   }
   return 0;
 }
@@ -660,7 +662,8 @@
     /* We have the body, now save it the entire contents to our
      * opened_file lists. */
     newfile = ALLOC(opened_file);
-    value = rb_str2cstr(body,&newfile->size);
+    value = RSTRING_PTR(body);
+    newfile->size = RSTRING_LEN(body);
     newfile->value = ALLOC_N(char,(newfile->size)+1);
     memcpy(newfile->value,value,newfile->size);
     newfile->value[newfile->size] = '\0';
@@ -715,7 +718,8 @@
       /* We have the body, now save it the entire contents to our
        * opened_file lists. */
       newfile = ALLOC(opened_file);
-      value = rb_str2cstr(body,&newfile->size);
+      value = RSTRING_PTR(body);
+      newfile->size = RSTRING_LEN(body);
       newfile->value = ALLOC_N(char,(newfile->size)+1);
       memcpy(newfile->value,value,newfile->size);
       newfile->writesize = newfile->size+1;
@@ -1074,7 +1078,8 @@
       rf_call(path,id_write_to,newstr);
     } else {
       long size;
-      char *str = rb_str2cstr(body,&size);
+      char *str = RSTRING_PTR(body);
+      size = RSTRING_LEN(body);
 
       /* Just in case offset is bigger than the file. */
       if (offset >= size) return 0;
@@ -1253,7 +1258,7 @@
       return 0;
     if (TYPE(ret) != T_STRING)
       return 0;
-    memcpy(buf, RSTRING_LEN(ret), RSTRING_LEN(ret));
+    memcpy(buf, RSTRING_PTR(ret), RSTRING_LEN(ret));
     return RSTRING_LEN(ret);
   }
 
@@ -1390,7 +1395,7 @@
   }
 
   rb_iv_set(cFuseFS,"@mountpoint",mountpoint);
-  fusefs_setup(STR2CSTR(mountpoint), &rf_oper, opts);
+  fusefs_setup(StringValuePtr(mountpoint), &rf_oper, opts);
   return Qtrue;
 }