move mrbgem initialization into sprintf.c
Also remove some unnecessary code.
DELETE
mrbgems/mruby-sprintf/src/kernel.c
-/*
-** kernel.c - Kernel module suppliment
-**
-** See Copyright Notice in mruby.h
-*/
-
-#include <mruby.h>
-
-mrb_value mrb_f_sprintf(mrb_state *mrb, mrb_value obj); /* in sprintf.c */
-
-void
-mrb_mruby_sprintf_gem_init(mrb_state* mrb)
-{
- struct RClass *krn;
-
- if (mrb->kernel_module == NULL) {
- mrb->kernel_module = mrb_define_module(mrb, "Kernel"); /* Might be PARANOID. */
- }
- krn = mrb->kernel_module;
-
- mrb_define_method(mrb, krn, "sprintf", mrb_f_sprintf, MRB_ARGS_REQ(1)|MRB_ARGS_REST());
- mrb_define_method(mrb, krn, "format", mrb_f_sprintf, MRB_ARGS_REQ(1)|MRB_ARGS_REST());
-}
-
-void
-mrb_mruby_sprintf_gem_final(mrb_state* mrb)
-{
- /* nothing to do. */
-}
-

MODIFY
mrbgems/mruby-sprintf/src/sprintf.c
mrbgems/mruby-sprintf/src/sprintf.c
@@ -1160,3 +1160,16 @@ fmt_setup(char *buf, size_t size, int c, int flags, mrb_int width, mrb_int prec)
*buf = '\0';
}
#endif
+
+void
+mrb_mruby_sprintf_gem_init(mrb_state *mrb)
+{
+ struct RClass *krn = mrb->kernel_module;
+ mrb_define_method(mrb, krn, "sprintf", mrb_f_sprintf, MRB_ARGS_ANY());
+ mrb_define_method(mrb, krn, "format", mrb_f_sprintf, MRB_ARGS_ANY());
+}
+
+void
+mrb_mruby_sprintf_gem_final(mrb_state *mrb)
+{
+}

move mrbgem initialization into sprintf.c

Also remove some unnecessary code.