+static void c_mark (RbEventHandler *h)
+{
+ rb_gc_mark (h->callback);
+}
+
+static void c_free (RbEventHandler *h)
+{
+ RbEventHandler *h2 = NULL;
+ int len = RARRAY (handlers)->len, i;
+ VALUE el;
+
+ if (!h->real || h->deleted) {
+ free (h);
+ return;
+ }
+
+ for (i = 0; i < len; i++) {
+ el = rb_ary_shift (handlers);
+
+ Data_Get_Struct (el, RbEventHandler, h2);
+
+ if (h == h2) {
+ ecore_event_handler_del (h->real);
+ break;
+ }
+
+ rb_ary_push (handlers, el);
+ }
+
+ free (h);
+}
+
+static VALUE c_alloc (VALUE klass)
+{
+ RbEventHandler *h = NULL;
+
+ return Data_Make_Struct (klass, RbEventHandler, c_mark, c_free, h);
+}
+