rua 0.2.2-mswin32 → 0.2.3-mswin32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/ext/rua.c +25 -7
  2. data/lib/i386-mswin32/rua.so +0 -0
  3. metadata +3 -3
data/ext/rua.c CHANGED
@@ -16,7 +16,7 @@ __declspec(dllexport) void Init_rua(void);
16
16
 
17
17
  #include "rua.h"
18
18
 
19
- #define VERSION "0.2.2"
19
+ #define VERSION "0.2.3"
20
20
  #define REF_RBOBJ "self"
21
21
 
22
22
  static const char *insecure_methods[] = {
@@ -121,9 +121,16 @@ void Init_rua() {
121
121
 
122
122
  static VALUE rua_alloc(VALUE klass) {
123
123
  struct rua *p = ALLOC(struct rua);
124
+
124
125
  p->R = ALLOC(struct rua_state);
126
+ p->R->rua = Qnil;
127
+ p->R->error_handler = Qnil;
128
+ return Data_Wrap_Struct(klass, rua_mark, rua_free, p);
129
+ }
125
130
 
126
- return Data_Wrap_Struct(klass, 0, rua_free, p);
131
+ static void rua_mark(struct rua *p) {
132
+ rb_gc_mark(p->R->rua);
133
+ rb_gc_mark(p->R->error_handler);
127
134
  }
128
135
 
129
136
  static void rua_free(struct rua *p) {
@@ -146,8 +153,9 @@ static VALUE rua_initialize(int argc, VALUE *argv, VALUE self) {
146
153
 
147
154
  Data_Get_Struct(self, struct rua, p);
148
155
  p->L = lua_open();
149
- p->R->secure = 1;
156
+ p->R->rua = self;
150
157
  p->R->error_handler = Qnil;
158
+ p->R->secure = 1;
151
159
 
152
160
  if (argc > 0) {
153
161
  rua_openlibs(argc, argv, self);
@@ -293,7 +301,7 @@ static VALUE rua_set_secure(VALUE self, VALUE secure) {
293
301
 
294
302
 
295
303
  /*
296
- * get error handler flag.
304
+ * get error handler.
297
305
  */
298
306
  static VALUE rua_get_error_handler(VALUE self) {
299
307
  struct rua *p;
@@ -303,7 +311,7 @@ static VALUE rua_get_error_handler(VALUE self) {
303
311
  }
304
312
 
305
313
  /*
306
- * set error handler flag.
314
+ * set error handler.
307
315
  */
308
316
  static VALUE rua_set_error_handler(VALUE self, VALUE error_handler) {
309
317
  struct rua *p;
@@ -347,7 +355,12 @@ static VALUE rua_method_missing(int argc, VALUE *argv, VALUE self) {
347
355
  static VALUE rua_func_alloc(VALUE klass) {
348
356
  struct rua_ref *p = ALLOC(struct rua_ref);
349
357
 
350
- return Data_Wrap_Struct(klass, 0, -1, p);
358
+ return Data_Wrap_Struct(klass, rua_func_mark, -1, p);
359
+ }
360
+
361
+ static void rua_func_mark(struct rua_ref *p) {
362
+ rb_gc_mark(p->R->rua);
363
+ rb_gc_mark(p->R->error_handler);
351
364
  }
352
365
 
353
366
  /*
@@ -399,7 +412,12 @@ static VALUE rua_func_call(int argc, VALUE *argv, VALUE self) {
399
412
  static VALUE rua_thread_alloc(VALUE klass) {
400
413
  struct rua_ref *p = ALLOC(struct rua_ref);
401
414
 
402
- return Data_Wrap_Struct(klass, 0, -1, p);
415
+ return Data_Wrap_Struct(klass, rua_thread_mark, -1, p);
416
+ }
417
+
418
+ static void rua_thread_mark(struct rua_ref *p) {
419
+ rb_gc_mark(p->R->rua);
420
+ rb_gc_mark(p->R->error_handler);
403
421
  }
404
422
 
405
423
  /*
Binary file
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: rua
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.2
7
- date: 2007-11-19 00:00:00 +09:00
6
+ version: 0.2.3
7
+ date: 2007-11-20 00:00:00 +09:00
8
8
  summary: Rua is a library for using Lua under Ruby.
9
9
  require_paths:
10
10
  - lib/i386-mswin32