Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
ac2adf34
Commit
ac2adf34
authored
May 18, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indentation fix
parent
a1c6996f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
29 deletions
+30
-29
mrbgems/mruby-objectspace/src/mruby_objectspace.c
mrbgems/mruby-objectspace/src/mruby_objectspace.c
+30
-29
No files found.
mrbgems/mruby-objectspace/src/mruby_objectspace.c
View file @
ac2adf34
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
struct
os_count_struct
{
struct
os_count_struct
{
size_t
total
;
size_t
total
;
size_t
freed
;
size_t
freed
;
size_t
counts
[
MRB_TT_MAXDEFINE
+
1
];
size_t
counts
[
MRB_TT_MAXDEFINE
+
1
];
};
};
...
@@ -16,10 +16,10 @@ os_count_object_type(mrb_state *mrb, struct RBasic* obj, void *data)
...
@@ -16,10 +16,10 @@ os_count_object_type(mrb_state *mrb, struct RBasic* obj, void *data)
obj_count
=
(
struct
os_count_struct
*
)(
data
);
obj_count
=
(
struct
os_count_struct
*
)(
data
);
if
(
is_dead
(
mrb
,
obj
))
{
if
(
is_dead
(
mrb
,
obj
))
{
obj_count
->
freed
++
;
obj_count
->
freed
++
;
}
else
{
}
else
{
obj_count
->
counts
[
obj
->
tt
]
++
;
obj_count
->
counts
[
obj
->
tt
]
++
;
obj_count
->
total
++
;
obj_count
->
total
++
;
}
}
}
}
...
@@ -46,32 +46,32 @@ os_count_object_type(mrb_state *mrb, struct RBasic* obj, void *data)
...
@@ -46,32 +46,32 @@ os_count_object_type(mrb_state *mrb, struct RBasic* obj, void *data)
mrb_value
mrb_value
os_count_objects
(
mrb_state
*
mrb
,
mrb_value
self
)
os_count_objects
(
mrb_state
*
mrb
,
mrb_value
self
)
{
{
struct
os_count_struct
obj_count
;
struct
os_count_struct
obj_count
;
size_t
i
;
size_t
i
;
mrb_value
hash
;
mrb_value
hash
;
if
(
mrb_get_args
(
mrb
,
"|H"
,
&
hash
)
==
0
)
{
if
(
mrb_get_args
(
mrb
,
"|H"
,
&
hash
)
==
0
)
{
hash
=
mrb_hash_new
(
mrb
);
hash
=
mrb_hash_new
(
mrb
);
}
}
if
(
!
mrb_test
(
mrb_hash_empty_p
(
mrb
,
hash
)))
{
if
(
!
mrb_test
(
mrb_hash_empty_p
(
mrb
,
hash
)))
{
mrb_hash_clear
(
mrb
,
hash
);
mrb_hash_clear
(
mrb
,
hash
);
}
}
for
(
i
=
0
;
i
<=
MRB_TT_MAXDEFINE
;
i
++
)
{
for
(
i
=
0
;
i
<=
MRB_TT_MAXDEFINE
;
i
++
)
{
obj_count
.
counts
[
i
]
=
0
;
obj_count
.
counts
[
i
]
=
0
;
}
}
obj_count
.
total
=
0
;
obj_count
.
total
=
0
;
obj_count
.
freed
=
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
,
"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
,
"FREE"
)),
mrb_fixnum_value
(
obj_count
.
freed
));
for
(
i
=
0
;
i
<
MRB_TT_MAXDEFINE
;
i
++
)
{
for
(
i
=
0
;
i
<
MRB_TT_MAXDEFINE
;
i
++
)
{
mrb_value
type
;
mrb_value
type
;
switch
(
i
)
{
switch
(
i
)
{
#define COUNT_TYPE(t) case (t): type = mrb_symbol_value(mrb_intern_cstr(mrb, #t)); break;
#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_FALSE
);
COUNT_TYPE
(
MRB_TT_FREE
);
COUNT_TYPE
(
MRB_TT_FREE
);
...
@@ -96,13 +96,14 @@ os_count_objects(mrb_state *mrb, mrb_value self)
...
@@ -96,13 +96,14 @@ os_count_objects(mrb_state *mrb, mrb_value self)
COUNT_TYPE
(
MRB_TT_ENV
);
COUNT_TYPE
(
MRB_TT_ENV
);
COUNT_TYPE
(
MRB_TT_DATA
);
COUNT_TYPE
(
MRB_TT_DATA
);
#undef COUNT_TYPE
#undef COUNT_TYPE
default:
type
=
mrb_fixnum_value
(
i
);
break
;
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
]));
}
}
if
(
obj_count
.
counts
[
i
])
mrb_hash_set
(
mrb
,
hash
,
type
,
mrb_fixnum_value
(
obj_count
.
counts
[
i
]));
}
return
hash
;
return
hash
;
}
}
void
void
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment