From 97d6891e453e7f189cc92f26300ac46c3c115aa3 Mon Sep 17 00:00:00 2001 From: Wincent Colaiuta Date: Fri, 29 Feb 2008 14:45:52 +0100 Subject: [PATCH] RSTRING_PTR and RSTRING_LEN macros for compatibility with Ruby 1.8.5 These macros were introduced with Ruby 1.8.6, so these are required if we want to build against Ruby 1.8.5. Signed-off-by: Wincent Colaiuta --- ext/thin_parser/thin.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/ext/thin_parser/thin.c b/ext/thin_parser/thin.c index 58985ed..45dbd6f 100644 --- a/ext/thin_parser/thin.c +++ b/ext/thin_parser/thin.c @@ -52,6 +52,15 @@ static VALUE global_path_info; /** Defines global strings in the init method. */ #define DEF_GLOBAL(N, val) global_##N = rb_obj_freeze(rb_str_new2(val)); rb_global_variable(&global_##N) +/* for compatibility with Ruby 1.8.5, which doesn't declare RSTRING_PTR */ +#ifndef RSTRING_PTR +#define RSTRING_PTR(s) (RSTRING(s)->ptr) +#endif + +/* for compatibility with Ruby 1.8.5, which doesn't declare RSTRING_LEN */ +#ifndef RSTRING_LEN +#define RSTRING_LEN(s) (RSTRING(s)->len) +#endif /* Defines the maximum allowed lengths for various input elements.*/ DEF_MAX_LENGTH(FIELD_NAME, 256); -- 1.5.4.3.dirty