diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-02-22 19:24:53 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-02-23 13:14:25 -0800 |
commit | ebc2093847705c382b4d83ed5120e44b9afad3c0 (patch) | |
tree | 71c9282fa6b65632d8991e1a449950154faae2c7 /ext/raindrops | |
parent | a73fe2f033a766a05ecef01bef015e2d1993bddd (diff) | |
download | raindrops-ebc2093847705c382b4d83ed5120e44b9afad3c0.tar.gz |
We might reuse that for other code...
Diffstat (limited to 'ext/raindrops')
-rw-r--r-- | ext/raindrops/linux_inet_diag.c | 16 | ||||
-rw-r--r-- | ext/raindrops/rstruct_19.h | 17 |
2 files changed, 18 insertions, 15 deletions
diff --git a/ext/raindrops/linux_inet_diag.c b/ext/raindrops/linux_inet_diag.c index 78859cb..9e42c64 100644 --- a/ext/raindrops/linux_inet_diag.c +++ b/ext/raindrops/linux_inet_diag.c @@ -8,22 +8,8 @@ #ifndef RSTRING_LEN # define RSTRING_LEN(s) (RSTRING(s)->len) #endif -#ifdef RSTRUCT -# ifndef RSTRUCT_PTR -# define RSTRUCT_PTR(s) (RSTRUCT(s)->ptr) -# endif -# ifndef RSTRUCT_LEN -# define RSTRUCT_LEN(s) (RSTRUCT(s)->len) -# endif -#endif -#ifndef HAVE_RB_STRUCT_ALLOC_NOINIT -static ID id_new; -static VALUE rb_struct_alloc_noinit(VALUE class) -{ - return rb_funcall(class, id_new, 0, 0); -} -#endif /* !defined(HAVE_RB_STRUCT_ALLOC_NOINIT) */ +#include "rstruct_19.h" /* partial emulation of the 1.9 rb_thread_blocking_region under 1.8 */ #ifndef HAVE_RB_THREAD_BLOCKING_REGION diff --git a/ext/raindrops/rstruct_19.h b/ext/raindrops/rstruct_19.h new file mode 100644 index 0000000..f156206 --- /dev/null +++ b/ext/raindrops/rstruct_19.h @@ -0,0 +1,17 @@ +#ifdef RSTRUCT +# ifndef RSTRUCT_PTR +# define RSTRUCT_PTR(s) (RSTRUCT(s)->ptr) +# endif +# ifndef RSTRUCT_LEN +# define RSTRUCT_LEN(s) (RSTRUCT(s)->len) +# endif +#endif + + +#ifndef HAVE_RB_STRUCT_ALLOC_NOINIT +static ID id_new; +static VALUE rb_struct_alloc_noinit(VALUE class) +{ + return rb_funcall(class, id_new, 0, 0); +} +#endif /* !defined(HAVE_RB_STRUCT_ALLOC_NOINIT) */ |