summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSatoshi Tagomori <[email protected]>2025-06-07 10:26:43 +0900
committerSatoshi Tagomori <[email protected]>2025-06-07 18:19:59 +0900
commitdd4e39a115d039b27ba20fb6eb3634e9b1043d81 (patch)
treed946628a4aa41c88a20125f0a12efe8f95cf47d3
parent20cf46039a90135b3d9efceabc73b0d41ad257b8 (diff)
Delete useless Namespace#current_details
The implementation of Namespace#current_details shows warning about use of snprintf directive arguments (only in gcc environments?). This method will be useless when the current namespace management will be updated.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13554
-rw-r--r--namespace.c104
1 files changed, 0 insertions, 104 deletions
diff --git a/namespace.c b/namespace.c
index 28ebba376a..44afdd8f21 100644
--- a/namespace.c
+++ b/namespace.c
@@ -280,109 +280,6 @@ rb_definition_namespace(void)
return ns;
}
-VALUE
-rb_current_namespace_details(VALUE opt)
-{
- const rb_callable_method_entry_t *cme;
- VALUE str, part, nsobj;
- char buf[2048];
- const char *path;
- int calling = 1;
- long i;
- rb_execution_context_t *ec = GET_EC();
- rb_control_frame_t *cfp = ec->cfp;
- rb_thread_t *th = rb_ec_thread_ptr(ec);
- const rb_namespace_t *ns = rb_current_namespace();
- rb_vm_t *vm = GET_VM();
- VALUE require_stack = vm->require_stack;
-
- str = rb_namespace_inspect(ns ? ns->ns_object : Qfalse);
- if (NIL_P(opt)) return str;
-
- rb_str_cat_cstr(str, "\n");
-
- part = rb_namespace_inspect(th->ns ? th->ns->ns_object : Qfalse);
- snprintf(buf, 2048, "main:%s, th->ns:%s, th->nss:%ld, rstack:%ld\n",
- main_namespace ? "t" : "f",
- RSTRING_PTR(part),
- th->namespaces ? RARRAY_LEN(th->namespaces) : 0,
- require_stack ? RARRAY_LEN(require_stack) : 0);
- RB_GC_GUARD(part);
- rb_str_cat_cstr(str, buf);
-
- if (th->namespaces && RARRAY_LEN(th->namespaces) > 0) {
- for (i=0; i<RARRAY_LEN(th->namespaces); i++) {
- nsobj = RARRAY_AREF(th->namespaces, i);
- part = rb_namespace_inspect(nsobj);
- snprintf(buf, 2048, " th->nss[%ld] %s\n", i, RSTRING_PTR(part));
- RB_GC_GUARD(part);
- rb_str_cat_cstr(str, buf);
- }
- }
-
-
- rb_str_cat_cstr(str, "calls:\n");
-
- while (calling && cfp) {
- const rb_namespace_t *proc_ns;
- VALUE bh;
- if (VM_FRAME_NS_SWITCH_P(cfp)) {
- bh = rb_vm_frame_block_handler(cfp);
- if (bh && vm_block_handler_type(bh) == block_handler_type_proc) {
- proc_ns = block_proc_namespace(VM_BH_TO_PROC(bh));
- if (NAMESPACE_USER_P(ns)) {
- part = rb_namespace_inspect(proc_ns->ns_object);
- snprintf(buf, 2048, " cfp->ns:%s", RSTRING_PTR(part));
- RB_GC_GUARD(part);
- calling = 0;
- break;
- }
- }
- }
- cme = rb_vm_frame_method_entry(cfp);
- if (cme && cme->def) {
- if (cme->def->type == VM_METHOD_TYPE_ISEQ)
- path = RSTRING_PTR(pathobj_path(cme->def->body.iseq.iseqptr->body->location.pathobj));
- else
- path = "(cfunc)";
- ns = cme->def->ns;
- if (ns) {
- part = rb_namespace_inspect(ns->ns_object);
- if (!namespace_ignore_builtin_primitive_methods_p(ns, cme->def)) {
- snprintf(buf, 2048, " cfp cme->def id:%s, ns:%s, exprim:t, path:%s\n",
- rb_id2name(cme->def->original_id),
- RSTRING_PTR(part),
- path);
- RB_GC_GUARD(part);
- rb_str_cat_cstr(str, buf);
- calling = 0;
- break;
- }
- else {
- snprintf(buf, 2048, " cfp cme->def id:%s, ns:%s, exprim:f, path:%s\n",
- rb_id2name(cme->def->original_id),
- RSTRING_PTR(part),
- path);
- RB_GC_GUARD(part);
- rb_str_cat_cstr(str, buf);
- }
- }
- else {
- snprintf(buf, 2048, " cfp cme->def id:%s, ns:null, path:%s\n",
- rb_id2name(cme->def->original_id),
- path);
- rb_str_cat_cstr(str, buf);
- }
- cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
- }
- else {
- calling = 0;
- }
- }
- rb_str_cat_cstr(str, ".\n");
- return str;
-}
-
static long namespace_id_counter = 0;
static long
@@ -1161,7 +1058,6 @@ Init_Namespace(void)
rb_define_singleton_method(rb_cNamespace, "enabled?", rb_namespace_s_getenabled, 0);
rb_define_singleton_method(rb_cNamespace, "current", rb_namespace_current, 0);
- rb_define_singleton_method(rb_cNamespace, "current_details", rb_current_namespace_details, 0);
rb_define_singleton_method(rb_cNamespace, "is_builtin?", rb_namespace_s_is_builtin_p, 1);
rb_define_method(rb_cNamespace, "load_path", rb_namespace_load_path, 0);