Skip to content

Commit

Permalink
Add Apache::globale_remove to remove global_variable when sharing mrb…
Browse files Browse the repository at this point in the history
…_state
  • Loading branch information
matsumotory committed Oct 9, 2013
1 parent f9c779d commit 39d6e1f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions example/gv_remove/remove.rb
@@ -0,0 +1,5 @@
# mrubyFixupsMiddle "/usr/local/apache/hooks/test.rb"
$hoge = 1
Apache::rputs global_variables.to_s
Apache::rputs "hoge"
Apache::rputs Apache::global_remove(:$hoge).to_s
2 changes: 1 addition & 1 deletion mruby
Submodule mruby updated 2 files
+1 −0 include/mruby/variable.h
+11 −0 src/variable.c
10 changes: 10 additions & 0 deletions src/ap_mrb_core.c
Expand Up @@ -256,6 +256,15 @@ mrb_value ap_mrb_server_name(mrb_state *mrb, mrb_value self)
return mrb_str_new_cstr(mrb, AP_SERVER_BASEPRODUCT);
}

mrb_value ap_mrb_f_global_remove(mrb_state *mrb, mrb_value self)
{
mrb_sym id;
mrb_get_args(mrb, "n", &id);
mrb_gv_remove(mrb, id);

return mrb_f_global_variables(mrb, self);
}

void ap_mruby_core_init(mrb_state *mrb, struct RClass *class_core)
{

Expand Down Expand Up @@ -335,4 +344,5 @@ void ap_mruby_core_init(mrb_state *mrb, struct RClass *class_core)
mrb_define_class_method(mrb, class_core, "mod_mruby_version", ap_mrb_get_mod_mruby_version, ARGS_NONE());
mrb_define_class_method(mrb, class_core, "server_version", ap_mrb_get_server_version, ARGS_NONE());
mrb_define_class_method(mrb, class_core, "server_build", ap_mrb_get_server_build, ARGS_NONE());
mrb_define_class_method(mrb, class_core, "global_remove", ap_mrb_f_global_remove, ARGS_REQ(1));
}
1 change: 1 addition & 0 deletions src/ap_mrb_core.h
Expand Up @@ -12,6 +12,7 @@

#include "http_protocol.h"
#include "mruby/string.h"
#include "mruby/variable.h"


#define INVALID_PRIORITY -1
Expand Down

0 comments on commit 39d6e1f

Please sign in to comment.