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
6f88c840
Commit
6f88c840
authored
Mar 01, 2013
by
Yukihiro Matz Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace instance_of check with structure check
parent
389da9dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
mrbgems/mruby-struct/src/struct.c
mrbgems/mruby-struct/src/struct.c
+6
-7
No files found.
mrbgems/mruby-struct/src/struct.c
View file @
6f88c840
...
...
@@ -13,7 +13,7 @@
#include "mruby/data.h"
#include "mruby/variable.h"
static
struct
mrb_data_type
mrb_struct_type
=
{
"mrb_struct"
,
NULL
};
static
mrb_data_type
mrb_struct_type
=
{
"mrb_struct"
,
NULL
};
#define RSTRUCT_ARY(st) ((struct RArray*)DATA_PTR(st))
#define RSTRUCT_LEN(st) RSTRUCT_ARY(st)->len
...
...
@@ -514,21 +514,20 @@ mrb_value
mrb_struct_init_copy
(
mrb_state
*
mrb
,
mrb_value
copy
)
{
mrb_value
s
,
a
;
struct
RArray
*
sv
;
int
i
,
len
;
mrb_get_args
(
mrb
,
"o"
,
&
s
);
if
(
mrb_obj_equal
(
mrb
,
copy
,
s
))
return
copy
;
if
(
!
mrb_obj_is_instance_of
(
mrb
,
s
,
mrb_obj_class
(
mrb
,
copy
)))
{
mrb_raise
(
mrb
,
E_TYPE_ERROR
,
"wrong argument class"
);
}
if
(
RSTRUCT_LEN
(
copy
)
!=
RSTRUCT_LEN
(
s
))
{
Data_Get_Struct
(
mrb
,
s
,
&
mrb_struct_type
,
sv
);
if
(
RSTRUCT_LEN
(
copy
)
!=
sv
->
len
)
{
mrb_raise
(
mrb
,
E_TYPE_ERROR
,
"struct size mismatch"
);
}
len
=
RSTRUCT_LEN
(
copy
)
;
len
=
sv
->
len
;
a
=
mrb_obj_value
(
RSTRUCT_ARY
(
copy
));
for
(
i
=
0
;
i
<
len
;
i
++
)
{
mrb_ary_set
(
mrb
,
a
,
i
,
RSTRUCT_PTR
(
s
)
[
i
]);
mrb_ary_set
(
mrb
,
a
,
i
,
sv
->
ptr
[
i
]);
}
return
copy
;
}
...
...
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