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
919af617
Commit
919af617
authored
Jun 27, 2014
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initialize nomem_err->mesg->c before exposing to Ruby world; close #2428
parent
4ce0a765
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
32 deletions
+8
-32
src/error.c
src/error.c
+8
-32
No files found.
src/error.c
View file @
919af617
...
...
@@ -91,8 +91,15 @@ static mrb_value
exc_to_s
(
mrb_state
*
mrb
,
mrb_value
exc
)
{
mrb_value
mesg
=
mrb_attr_get
(
mrb
,
exc
,
mrb_intern_lit
(
mrb
,
"mesg"
));
struct
RObject
*
p
;
if
(
mrb_nil_p
(
mesg
))
return
mrb_str_new_cstr
(
mrb
,
mrb_obj_classname
(
mrb
,
exc
));
if
(
!
mrb_string_p
(
mesg
))
{
return
mrb_str_new_cstr
(
mrb
,
mrb_obj_classname
(
mrb
,
exc
));
}
p
=
mrb_obj_ptr
(
mesg
);
if
(
!
p
->
c
)
{
p
->
c
=
mrb
->
string_class
;
}
return
mesg
;
}
...
...
@@ -167,36 +174,6 @@ exc_inspect(mrb_state *mrb, mrb_value exc)
}
static
mrb_value
exc_equal
(
mrb_state
*
mrb
,
mrb_value
exc
)
{
mrb_value
obj
;
mrb_value
mesg
;
mrb_bool
equal_p
;
mrb_sym
id_mesg
=
mrb_intern_lit
(
mrb
,
"mesg"
);
mrb_get_args
(
mrb
,
"o"
,
&
obj
);
if
(
mrb_obj_equal
(
mrb
,
exc
,
obj
))
{
equal_p
=
TRUE
;
}
else
{
if
(
mrb_obj_class
(
mrb
,
exc
)
!=
mrb_obj_class
(
mrb
,
obj
))
{
if
(
mrb_respond_to
(
mrb
,
obj
,
mrb_intern_lit
(
mrb
,
"message"
)))
{
mesg
=
mrb_funcall
(
mrb
,
obj
,
"message"
,
0
);
}
else
return
mrb_false_value
();
}
else
{
mesg
=
mrb_attr_get
(
mrb
,
obj
,
id_mesg
);
}
equal_p
=
mrb_equal
(
mrb
,
mrb_attr_get
(
mrb
,
exc
,
id_mesg
),
mesg
);
}
return
mrb_bool_value
(
equal_p
);
}
static
void
exc_debug_info
(
mrb_state
*
mrb
,
struct
RObject
*
exc
)
{
...
...
@@ -468,7 +445,6 @@ mrb_init_exception(mrb_state *mrb)
mrb_define_class_method
(
mrb
,
exception
,
"exception"
,
mrb_instance_new
,
MRB_ARGS_ANY
());
mrb_define_method
(
mrb
,
exception
,
"exception"
,
exc_exception
,
MRB_ARGS_ANY
());
mrb_define_method
(
mrb
,
exception
,
"initialize"
,
exc_initialize
,
MRB_ARGS_ANY
());
mrb_define_method
(
mrb
,
exception
,
"=="
,
exc_equal
,
MRB_ARGS_REQ
(
1
));
mrb_define_method
(
mrb
,
exception
,
"to_s"
,
exc_to_s
,
MRB_ARGS_NONE
());
mrb_define_method
(
mrb
,
exception
,
"message"
,
exc_message
,
MRB_ARGS_NONE
());
mrb_define_method
(
mrb
,
exception
,
"inspect"
,
exc_inspect
,
MRB_ARGS_NONE
());
...
...
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