From eb05ff0760e26919fb039b009a4fdc47da5e8c99 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 25 Mar 2009 14:58:06 -0700 Subject: [PATCH] fix compile against ruby 1.8.4 --- bindings/ruby/rbsigar.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bindings/ruby/rbsigar.c b/bindings/ruby/rbsigar.c index adfddb1c..4464ec71 100644 --- a/bindings/ruby/rbsigar.c +++ b/bindings/ruby/rbsigar.c @@ -17,6 +17,7 @@ */ #include +#include #include #include #include "sigar.h" @@ -36,6 +37,12 @@ #define RSTRING_LEN(s) RSTRING(s)->len #endif +#if (RUBY_VERSION_MAJOR >= 1) && ((RUBY_VERSION_MINOR == 8) && (RUBY_VERSION_TEENY >= 6)) +# define RB_REGEX_ERROR rb_eRegexpError +#else +# define RB_REGEX_ERROR rb_eArgError +#endif + static sigar_t *rb_sigar_get(VALUE obj) { sigar_t *sigar; @@ -56,7 +63,7 @@ static int rbsigar_ptql_re_impl(void *data, /* XXX cache */ if ((err = re_compile_pattern(needle, strlen(needle), regex))) { re_free_pattern(regex); - rb_raise(rb_eRegexpError, "%s", err); + rb_raise(RB_REGEX_ERROR, "%s", err); return 0; }