about summary refs log tree commit homepage
path: root/ext
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-05-03 18:45:06 +0000
committerEric Wong <normalperson@yhbt.net>2013-05-03 18:48:23 +0000
commit5a757f1515d4131ad4f6f1203dd6a117a9005d4f (patch)
treee965863f1ba6d78dfcbd9661ffc24927ed084e23 /ext
parenta64016a9c6e80302da46b46b96fa2f3765ea5591 (diff)
downloadsleepy_penguin-5a757f1515d4131ad4f6f1203dd6a117a9005d4f.tar.gz
This allows the Ruby-visible constant to always be up-to-date
with the release.
Diffstat (limited to 'ext')
-rw-r--r--ext/sleepy_penguin/init.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/sleepy_penguin/init.c b/ext/sleepy_penguin/init.c
index cab97ed..9b4f31c 100644
--- a/ext/sleepy_penguin/init.c
+++ b/ext/sleepy_penguin/init.c
@@ -1,6 +1,8 @@
 #define _GNU_SOURCE
+#include <ruby.h>
 #include <unistd.h>
 #include <sys/types.h>
+#include "git_version.h"
 #define L1_CACHE_LINE_MAX 128 /* largest I've seen (Pentium 4) */
 size_t rb_sp_l1_cache_line_size;
 
@@ -53,8 +55,14 @@ static size_t l1_cache_line_size_detect(void)
 
 void Init_sleepy_penguin_ext(void)
 {
+        VALUE mSleepyPenguin;
+
         rb_sp_l1_cache_line_size = l1_cache_line_size_detect();
 
+        mSleepyPenguin = rb_define_module("SleepyPenguin");
+        rb_define_const(mSleepyPenguin, "SLEEPY_PENGUIN_VERSION",
+                        rb_str_new2(MY_GIT_VERSION));
+
         sleepy_penguin_init_kqueue();
         sleepy_penguin_init_epoll();
         sleepy_penguin_init_timerfd();