Skip to content

Commit dd4e39a

Browse files
committed
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.
1 parent 20cf460 commit dd4e39a

File tree

1 file changed

+0
-104
lines changed

1 file changed

+0
-104
lines changed

namespace.c

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -280,109 +280,6 @@ rb_definition_namespace(void)
280280
return ns;
281281
}
282282

283-
VALUE
284-
rb_current_namespace_details(VALUE opt)
285-
{
286-
const rb_callable_method_entry_t *cme;
287-
VALUE str, part, nsobj;
288-
char buf[2048];
289-
const char *path;
290-
int calling = 1;
291-
long i;
292-
rb_execution_context_t *ec = GET_EC();
293-
rb_control_frame_t *cfp = ec->cfp;
294-
rb_thread_t *th = rb_ec_thread_ptr(ec);
295-
const rb_namespace_t *ns = rb_current_namespace();
296-
rb_vm_t *vm = GET_VM();
297-
VALUE require_stack = vm->require_stack;
298-
299-
str = rb_namespace_inspect(ns ? ns->ns_object : Qfalse);
300-
if (NIL_P(opt)) return str;
301-
302-
rb_str_cat_cstr(str, "\n");
303-
304-
part = rb_namespace_inspect(th->ns ? th->ns->ns_object : Qfalse);
305-
snprintf(buf, 2048, "main:%s, th->ns:%s, th->nss:%ld, rstack:%ld\n",
306-
main_namespace ? "t" : "f",
307-
RSTRING_PTR(part),
308-
th->namespaces ? RARRAY_LEN(th->namespaces) : 0,
309-
require_stack ? RARRAY_LEN(require_stack) : 0);
310-
RB_GC_GUARD(part);
311-
rb_str_cat_cstr(str, buf);
312-
313-
if (th->namespaces && RARRAY_LEN(th->namespaces) > 0) {
314-
for (i=0; i<RARRAY_LEN(th->namespaces); i++) {
315-
nsobj = RARRAY_AREF(th->namespaces, i);
316-
part = rb_namespace_inspect(nsobj);
317-
snprintf(buf, 2048, " th->nss[%ld] %s\n", i, RSTRING_PTR(part));
318-
RB_GC_GUARD(part);
319-
rb_str_cat_cstr(str, buf);
320-
}
321-
}
322-
323-
324-
rb_str_cat_cstr(str, "calls:\n");
325-
326-
while (calling && cfp) {
327-
const rb_namespace_t *proc_ns;
328-
VALUE bh;
329-
if (VM_FRAME_NS_SWITCH_P(cfp)) {
330-
bh = rb_vm_frame_block_handler(cfp);
331-
if (bh && vm_block_handler_type(bh) == block_handler_type_proc) {
332-
proc_ns = block_proc_namespace(VM_BH_TO_PROC(bh));
333-
if (NAMESPACE_USER_P(ns)) {
334-
part = rb_namespace_inspect(proc_ns->ns_object);
335-
snprintf(buf, 2048, " cfp->ns:%s", RSTRING_PTR(part));
336-
RB_GC_GUARD(part);
337-
calling = 0;
338-
break;
339-
}
340-
}
341-
}
342-
cme = rb_vm_frame_method_entry(cfp);
343-
if (cme && cme->def) {
344-
if (cme->def->type == VM_METHOD_TYPE_ISEQ)
345-
path = RSTRING_PTR(pathobj_path(cme->def->body.iseq.iseqptr->body->location.pathobj));
346-
else
347-
path = "(cfunc)";
348-
ns = cme->def->ns;
349-
if (ns) {
350-
part = rb_namespace_inspect(ns->ns_object);
351-
if (!namespace_ignore_builtin_primitive_methods_p(ns, cme->def)) {
352-
snprintf(buf, 2048, " cfp cme->def id:%s, ns:%s, exprim:t, path:%s\n",
353-
rb_id2name(cme->def->original_id),
354-
RSTRING_PTR(part),
355-
path);
356-
RB_GC_GUARD(part);
357-
rb_str_cat_cstr(str, buf);
358-
calling = 0;
359-
break;
360-
}
361-
else {
362-
snprintf(buf, 2048, " cfp cme->def id:%s, ns:%s, exprim:f, path:%s\n",
363-
rb_id2name(cme->def->original_id),
364-
RSTRING_PTR(part),
365-
path);
366-
RB_GC_GUARD(part);
367-
rb_str_cat_cstr(str, buf);
368-
}
369-
}
370-
else {
371-
snprintf(buf, 2048, " cfp cme->def id:%s, ns:null, path:%s\n",
372-
rb_id2name(cme->def->original_id),
373-
path);
374-
rb_str_cat_cstr(str, buf);
375-
}
376-
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
377-
}
378-
else {
379-
calling = 0;
380-
}
381-
}
382-
rb_str_cat_cstr(str, ".\n");
383-
return str;
384-
}
385-
386283
static long namespace_id_counter = 0;
387284

388285
static long
@@ -1161,7 +1058,6 @@ Init_Namespace(void)
11611058

11621059
rb_define_singleton_method(rb_cNamespace, "enabled?", rb_namespace_s_getenabled, 0);
11631060
rb_define_singleton_method(rb_cNamespace, "current", rb_namespace_current, 0);
1164-
rb_define_singleton_method(rb_cNamespace, "current_details", rb_current_namespace_details, 0);
11651061
rb_define_singleton_method(rb_cNamespace, "is_builtin?", rb_namespace_s_is_builtin_p, 1);
11661062

11671063
rb_define_method(rb_cNamespace, "load_path", rb_namespace_load_path, 0);

0 commit comments

Comments
 (0)