remove :to_io support
[clogger.git] / ext / clogger_ext / ruby_1_9_compat.h
blobde9f074912cb2b64c57522985088b218316f5af2
1 /* Ruby 1.8.6+ macros (for compatibility with Ruby 1.9) */
2 #ifndef RSTRING_PTR
3 # define RSTRING_PTR(s) (RSTRING(s)->ptr)
4 #endif
5 #ifndef RSTRING_LEN
6 # define RSTRING_LEN(s) (RSTRING(s)->len)
7 #endif
8 #ifndef RARRAY_LEN
9 # define RARRAY_LEN(s) (RARRAY(s)->len)
10 #endif
12 #ifndef HAVE_RB_STR_SET_LEN
13 /* this is taken from Ruby 1.8.7, 1.8.6 may not have it */
14 static void rb_18_str_set_len(VALUE str, long len)
16 RSTRING(str)->len = len;
17 RSTRING(str)->ptr[len] = '\0';
19 #define rb_str_set_len(str,len) rb_18_str_set_len(str,len)
20 #endif