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
f77fb11f
Commit
f77fb11f
authored
Jul 28, 2014
by
take_cheeze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use RString in `mesg` instead.
parent
e926b532
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
9 deletions
+16
-9
include/mruby/error.h
include/mruby/error.h
+2
-2
src/error.c
src/error.c
+11
-4
src/gc.c
src/gc.c
+3
-3
No files found.
include/mruby/error.h
View file @
f77fb11f
...
...
@@ -14,11 +14,11 @@ extern "C" {
struct
RException
{
MRB_OBJECT_HEADER
;
struct
iv_tbl
*
iv
;
mrb_value
mesg
;
struct
RString
*
mesg
;
};
#define mrb_exc_ptr(v) ((struct RException*)mrb_ptr(v))
#define MRB_EXC_MESG_
INIT
_FLAG 0x100
#define MRB_EXC_MESG_
STRING
_FLAG 0x100
void
mrb_sys_fail
(
mrb_state
*
mrb
,
const
char
*
mesg
);
mrb_value
mrb_exc_new_str
(
mrb_state
*
mrb
,
struct
RClass
*
c
,
mrb_value
str
);
...
...
src/error.c
View file @
f77fb11f
...
...
@@ -21,15 +21,22 @@
static
void
exc_mesg_set
(
mrb_state
*
mrb
,
struct
RException
*
exc
,
mrb_value
mesg
)
{
exc
->
flags
|=
MRB_EXC_MESG_INIT_FLAG
;
exc
->
mesg
=
mesg
;
mrb_field_write_barrier_value
(
mrb
,
(
struct
RBasic
*
)
exc
,
mesg
);
if
(
mrb_string_p
(
mesg
))
{
exc
->
flags
|=
MRB_EXC_MESG_STRING_FLAG
;
exc
->
mesg
=
RSTRING
(
mesg
);
mrb_field_write_barrier_value
(
mrb
,
(
struct
RBasic
*
)
exc
,
mesg
);
}
else
if
(
!
mrb_nil_p
(
mesg
))
{
exc
->
flags
&=
~
MRB_EXC_MESG_STRING_FLAG
;
mrb_obj_iv_set
(
mrb
,
(
struct
RObject
*
)
exc
,
mrb_intern_lit
(
mrb
,
"mesg"
),
mesg
);
}
}
static
mrb_value
exc_mesg_get
(
mrb_state
*
mrb
,
struct
RException
*
exc
)
{
return
(
exc
->
flags
&
MRB_EXC_MESG_INIT_FLAG
)
!=
0
?
exc
->
mesg
:
mrb_nil_value
();
return
(
exc
->
flags
&
MRB_EXC_MESG_STRING_FLAG
)
!=
0
?
mrb_obj_value
(
exc
->
mesg
)
:
mrb_obj_iv_get
(
mrb
,
(
struct
RObject
*
)
exc
,
mrb_intern_lit
(
mrb
,
"mesg"
));
}
mrb_value
...
...
src/gc.c
View file @
f77fb11f
...
...
@@ -582,8 +582,8 @@ gc_mark_children(mrb_state *mrb, struct RBasic *obj)
case
MRB_TT_EXCEPTION
:
mrb_gc_mark_iv
(
mrb
,
(
struct
RObject
*
)
obj
);
if
((
obj
->
flags
&
MRB_EXC_MESG_
INIT
_FLAG
)
!=
0
)
{
mrb_gc_mark
_value
(
mrb
,
((
struct
RException
*
)
obj
)
->
mesg
);
if
((
obj
->
flags
&
MRB_EXC_MESG_
STRING
_FLAG
)
!=
0
)
{
mrb_gc_mark
(
mrb
,
(
struct
RBasic
*
)
((
struct
RException
*
)
obj
)
->
mesg
);
}
break
;
...
...
@@ -808,7 +808,7 @@ gc_gray_mark(mrb_state *mrb, struct RBasic *obj)
case
MRB_TT_EXCEPTION
:
children
+=
mrb_gc_mark_iv_size
(
mrb
,
(
struct
RObject
*
)
obj
);
if
((
obj
->
flags
&
MRB_EXC_MESG_
INIT
_FLAG
)
!=
0
)
{
if
((
obj
->
flags
&
MRB_EXC_MESG_
STRING
_FLAG
)
!=
0
)
{
children
++
;
}
break
;
...
...
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