fix compile against ruby 1.8.4
This commit is contained in:
parent
6819b18af6
commit
eb05ff0760
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ruby.h>
|
#include <ruby.h>
|
||||||
|
#include <version.h>
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "sigar.h"
|
#include "sigar.h"
|
||||||
|
@ -36,6 +37,12 @@
|
||||||
#define RSTRING_LEN(s) RSTRING(s)->len
|
#define RSTRING_LEN(s) RSTRING(s)->len
|
||||||
#endif
|
#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)
|
static sigar_t *rb_sigar_get(VALUE obj)
|
||||||
{
|
{
|
||||||
sigar_t *sigar;
|
sigar_t *sigar;
|
||||||
|
@ -56,7 +63,7 @@ static int rbsigar_ptql_re_impl(void *data,
|
||||||
/* XXX cache */
|
/* XXX cache */
|
||||||
if ((err = re_compile_pattern(needle, strlen(needle), regex))) {
|
if ((err = re_compile_pattern(needle, strlen(needle), regex))) {
|
||||||
re_free_pattern(regex);
|
re_free_pattern(regex);
|
||||||
rb_raise(rb_eRegexpError, "%s", err);
|
rb_raise(RB_REGEX_ERROR, "%s", err);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue