mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
indentation fix
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
struct os_count_struct {
|
||||
size_t total;
|
||||
size_t freed;
|
||||
size_t freed;
|
||||
size_t counts[MRB_TT_MAXDEFINE+1];
|
||||
};
|
||||
|
||||
@@ -16,10 +16,10 @@ os_count_object_type(mrb_state *mrb, struct RBasic* obj, void *data)
|
||||
obj_count = (struct os_count_struct*)(data);
|
||||
|
||||
if (is_dead(mrb, obj)) {
|
||||
obj_count->freed++;
|
||||
obj_count->freed++;
|
||||
} else {
|
||||
obj_count->counts[obj->tt]++;
|
||||
obj_count->total++;
|
||||
obj_count->counts[obj->tt]++;
|
||||
obj_count->total++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,32 +46,32 @@ os_count_object_type(mrb_state *mrb, struct RBasic* obj, void *data)
|
||||
mrb_value
|
||||
os_count_objects(mrb_state *mrb, mrb_value self)
|
||||
{
|
||||
struct os_count_struct obj_count;
|
||||
size_t i;
|
||||
mrb_value hash;
|
||||
struct os_count_struct obj_count;
|
||||
size_t i;
|
||||
mrb_value hash;
|
||||
|
||||
if (mrb_get_args(mrb, "|H", &hash) == 0) {
|
||||
hash = mrb_hash_new(mrb);
|
||||
}
|
||||
if (mrb_get_args(mrb, "|H", &hash) == 0) {
|
||||
hash = mrb_hash_new(mrb);
|
||||
}
|
||||
|
||||
if (!mrb_test(mrb_hash_empty_p(mrb, hash))) {
|
||||
mrb_hash_clear(mrb, hash);
|
||||
}
|
||||
if (!mrb_test(mrb_hash_empty_p(mrb, hash))) {
|
||||
mrb_hash_clear(mrb, hash);
|
||||
}
|
||||
|
||||
for (i = 0; i <= MRB_TT_MAXDEFINE; i++) {
|
||||
obj_count.counts[i] = 0;
|
||||
}
|
||||
obj_count.total = 0;
|
||||
obj_count.freed = 0;
|
||||
for (i = 0; i <= MRB_TT_MAXDEFINE; i++) {
|
||||
obj_count.counts[i] = 0;
|
||||
}
|
||||
obj_count.total = 0;
|
||||
obj_count.freed = 0;
|
||||
|
||||
mrb_objspace_each_objects(mrb, os_count_object_type, &obj_count);
|
||||
mrb_objspace_each_objects(mrb, os_count_object_type, &obj_count);
|
||||
|
||||
mrb_hash_set(mrb, hash, mrb_symbol_value(mrb_intern_cstr(mrb, "TOTAL")), mrb_fixnum_value(obj_count.total));
|
||||
mrb_hash_set(mrb, hash, mrb_symbol_value(mrb_intern_cstr(mrb, "FREE")), mrb_fixnum_value(obj_count.freed));
|
||||
mrb_hash_set(mrb, hash, mrb_symbol_value(mrb_intern_cstr(mrb, "TOTAL")), mrb_fixnum_value(obj_count.total));
|
||||
mrb_hash_set(mrb, hash, mrb_symbol_value(mrb_intern_cstr(mrb, "FREE")), mrb_fixnum_value(obj_count.freed));
|
||||
|
||||
for (i = 0; i < MRB_TT_MAXDEFINE; i++) {
|
||||
mrb_value type;
|
||||
switch (i) {
|
||||
for (i = 0; i < MRB_TT_MAXDEFINE; i++) {
|
||||
mrb_value type;
|
||||
switch (i) {
|
||||
#define COUNT_TYPE(t) case (t): type = mrb_symbol_value(mrb_intern_cstr(mrb, #t)); break;
|
||||
COUNT_TYPE(MRB_TT_FALSE);
|
||||
COUNT_TYPE(MRB_TT_FREE);
|
||||
@@ -96,13 +96,14 @@ os_count_objects(mrb_state *mrb, mrb_value self)
|
||||
COUNT_TYPE(MRB_TT_ENV);
|
||||
COUNT_TYPE(MRB_TT_DATA);
|
||||
#undef COUNT_TYPE
|
||||
default: type = mrb_fixnum_value(i); break;
|
||||
}
|
||||
if (obj_count.counts[i])
|
||||
mrb_hash_set(mrb, hash, type, mrb_fixnum_value(obj_count.counts[i]));
|
||||
default:
|
||||
type = mrb_fixnum_value(i); break;
|
||||
}
|
||||
if (obj_count.counts[i])
|
||||
mrb_hash_set(mrb, hash, type, mrb_fixnum_value(obj_count.counts[i]));
|
||||
}
|
||||
|
||||
return hash;
|
||||
return hash;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user