summaryrefslogtreecommitdiff
path: root/src/plugins/ruby/weechat-ruby-api.h
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2019-08-20 07:57:01 +0200
committerSébastien Helleu <flashcode@flashtux.org>2019-08-20 07:57:01 +0200
commit21dca71ee06d8fe4897f1348ce10ac483d8bcc5c (patch)
tree264e11bbb3a6819407c5155397b96ae93f6b102c /src/plugins/ruby/weechat-ruby-api.h
parent7f62985f8948750f381e0bfd3b7a1ecc22eb8144 (diff)
downloadweechat-21dca71ee06d8fe4897f1348ce10ac483d8bcc5c.zip
ruby: fix compilation with Ruby < 2.3
Diffstat (limited to 'src/plugins/ruby/weechat-ruby-api.h')
-rw-r--r--src/plugins/ruby/weechat-ruby-api.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/ruby/weechat-ruby-api.h b/src/plugins/ruby/weechat-ruby-api.h
index 072a9b596..bc9219ecb 100644
--- a/src/plugins/ruby/weechat-ruby-api.h
+++ b/src/plugins/ruby/weechat-ruby-api.h
@@ -21,10 +21,16 @@
#ifndef WEECHAT_PLUGIN_RUBY_API_H
#define WEECHAT_PLUGIN_RUBY_API_H
+/* required for Ruby < 2.3 */
+#ifndef RB_FIXNUM_P
+#define RB_FIXNUM_P(f) (((int)(SIGNED_VALUE)(f))&RUBY_FIXNUM_FLAG)
+#endif
+
/* required for Ruby < 2.4 */
#ifndef RB_INTEGER_TYPE_P
#define RB_INTEGER_TYPE_P(obj) (RB_FIXNUM_P(obj) || RB_TYPE_P(obj, T_BIGNUM))
#endif
+
#define CHECK_INTEGER(obj) \
if (!RB_INTEGER_TYPE_P(obj)) \
{ \