Navigation Menu

Skip to content

Commit

Permalink
plugin ruby:use grn_plugin_command_create API instead of the macro
Browse files Browse the repository at this point in the history
  • Loading branch information
naoa committed Jun 20, 2014
1 parent aff6a36 commit 3ebc739
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
4 changes: 2 additions & 2 deletions plugins/ruby/eval.c
Expand Up @@ -57,8 +57,8 @@ GRN_PLUGIN_REGISTER(grn_ctx *ctx)
{
grn_expr_var vars[1];

DEF_VAR(vars[0], "script");
DEF_COMMAND("ruby_eval", command_ruby_eval, 1, vars);
grn_plugin_expr_var_init(ctx, &vars[0], "script", -1);
grn_plugin_command_create(ctx, "ruby_eval", -1, command_ruby_eval, 1, vars);

return ctx->rc;
}
4 changes: 2 additions & 2 deletions plugins/ruby/load.c
Expand Up @@ -56,8 +56,8 @@ GRN_PLUGIN_REGISTER(grn_ctx *ctx)
{
grn_expr_var vars[1];

DEF_VAR(vars[0], "path");
DEF_COMMAND("ruby_load", command_ruby_load, 1, vars);
grn_plugin_expr_var_init(ctx, &vars[0], "path", -1);
grn_plugin_command_create(ctx, "ruby_load", -1, command_ruby_load, 1, vars);

return ctx->rc;
}
10 changes: 0 additions & 10 deletions plugins/ruby/ruby_plugin.h
Expand Up @@ -69,16 +69,6 @@ GRN_PLUGIN_INIT(grn_ctx *ctx)
return GRN_SUCCESS;
}

#define DEF_VAR(v,x) do {\
(v).name = (x);\
(v).name_size = (x) ? sizeof(x) - 1 : 0;\
GRN_TEXT_INIT(&(v).value, 0);\
} while (0)

#define DEF_COMMAND(name, func, nvars, vars)\
(grn_proc_create(ctx, (name), (sizeof(name) - 1),\
GRN_PROC_COMMAND, (func), NULL, NULL, (nvars), (vars)))

grn_rc
GRN_PLUGIN_FIN(grn_ctx *ctx)
{
Expand Down

0 comments on commit 3ebc739

Please sign in to comment.