Ruby
1.9.3p429(2013-05-15revision40747)
Main Page
Modules
Data Structures
Files
File List
Globals
ext
-test-
string
cstr.c
Go to the documentation of this file.
1
#include "ruby.h"
2
3
static
VALUE
4
bug_str_cstr_term
(
VALUE
str)
5
{
6
long
len
;
7
char
*s;
8
rb_str_modify
(str);
9
len =
RSTRING_LEN
(str);
10
RSTRING_PTR
(str)[
len
] =
'x'
;
11
s =
StringValueCStr
(str);
12
rb_gc
();
13
return
INT2NUM
(s[len]);
14
}
15
16
void
17
Init_cstr
(
VALUE
klass)
18
{
19
rb_define_method
(klass,
"cstr_term"
,
bug_str_cstr_term
, 0);
20
}
21
Generated on Thu May 23 2013 20:33:00 for Ruby by
1.8.3