static int fc_i(ID key, VALUE value, struct fc_result *res) { if (!rb_is_const_id(key)) return ST_CONTINUE; if (value == res->klass) { res->path = fc_path(res, key); return ST_STOP; } switch (TYPE(value)) { case T_MODULE: case T_CLASS: { CFDictionaryRef iv_dict = rb_class_ivar_dict(value); if (iv_dict == NULL) return ST_CONTINUE; else { struct fc_result arg; struct fc_result *list; list = res; while (list) { if (list->track == value) return ST_CONTINUE; list = list->prev; } arg.name = key; arg.path = 0; arg.klass = res->klass; arg.track = value; arg.prev = res; ivar_dict_foreach(iv_dict, fc_i, (VALUE)&arg); if (arg.path) { res->path = arg.path; return ST_STOP; } } break; } default: break; } return ST_CONTINUE; }
static int fc_i(ID key, rb_const_entry_t *ce, struct fc_result *res) { VALUE value = ce->value; if (!rb_is_const_id(key)) return ST_CONTINUE; if (value == res->klass) { res->path = fc_path(res, key); return ST_STOP; } switch (TYPE(value)) { case T_MODULE: case T_CLASS: if (!RCLASS_CONST_TBL(value)) return ST_CONTINUE; else { struct fc_result arg; struct fc_result *list; list = res; while (list) { if (list->track == value) return ST_CONTINUE; list = list->prev; } arg.name = key; arg.path = 0; arg.klass = res->klass; arg.track = value; arg.prev = res; st_foreach(RCLASS_CONST_TBL(value), fc_i, (st_data_t)&arg); if (arg.path) { res->path = arg.path; return ST_STOP; } } break; default: break; } return ST_CONTINUE; }