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
0ff28c9e
Commit
0ff28c9e
authored
Aug 11, 2017
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Silence integer type conversion warnings.
parent
ef0b2397
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
src/string.c
src/string.c
+9
-8
src/vm.c
src/vm.c
+3
-3
No files found.
src/string.c
View file @
0ff28c9e
...
...
@@ -40,7 +40,7 @@ str_new_static(mrb_state *mrb, const char *p, size_t len)
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"string size too big"
);
}
s
=
mrb_obj_alloc_string
(
mrb
);
s
->
as
.
heap
.
len
=
len
;
s
->
as
.
heap
.
len
=
(
mrb_int
)
len
;
s
->
as
.
heap
.
aux
.
capa
=
0
;
/* nofree */
s
->
as
.
heap
.
ptr
=
(
char
*
)
p
;
s
->
flags
=
MRB_STR_NOFREE
;
...
...
@@ -68,8 +68,8 @@ str_new(mrb_state *mrb, const char *p, size_t len)
if
(
len
>=
MRB_INT_MAX
)
{
mrb_raise
(
mrb
,
E_ARGUMENT_ERROR
,
"string size too big"
);
}
s
->
as
.
heap
.
len
=
len
;
s
->
as
.
heap
.
aux
.
capa
=
len
;
s
->
as
.
heap
.
len
=
(
mrb_int
)
len
;
s
->
as
.
heap
.
aux
.
capa
=
(
mrb_int
)
len
;
s
->
as
.
heap
.
ptr
=
(
char
*
)
mrb_malloc
(
mrb
,
len
+
1
);
if
(
p
)
{
memcpy
(
s
->
as
.
heap
.
ptr
,
p
,
len
);
...
...
@@ -112,7 +112,7 @@ mrb_str_buf_new(mrb_state *mrb, size_t capa)
capa
=
MRB_STR_BUF_MIN_SIZE
;
}
s
->
as
.
heap
.
len
=
0
;
s
->
as
.
heap
.
aux
.
capa
=
capa
;
s
->
as
.
heap
.
aux
.
capa
=
(
mrb_int
)
capa
;
s
->
as
.
heap
.
ptr
=
(
char
*
)
mrb_malloc
(
mrb
,
capa
+
1
);
RSTR_PTR
(
s
)[
0
]
=
'\0'
;
...
...
@@ -341,7 +341,8 @@ mrb_memsearch_qs(const unsigned char *xs, mrb_int m, const unsigned char *ys, mr
{
const
unsigned
char
*
x
=
xs
,
*
xe
=
xs
+
m
;
const
unsigned
char
*
y
=
ys
;
int
i
,
qstable
[
256
];
int
i
;
ptrdiff_t
qstable
[
256
];
/* Preprocessing */
for
(
i
=
0
;
i
<
256
;
++
i
)
...
...
@@ -351,7 +352,7 @@ mrb_memsearch_qs(const unsigned char *xs, mrb_int m, const unsigned char *ys, mr
/* Searching */
for
(;
y
+
m
<=
ys
+
n
;
y
+=
*
(
qstable
+
y
[
m
]))
{
if
(
*
xs
==
*
y
&&
memcmp
(
xs
,
y
,
m
)
==
0
)
return
y
-
ys
;
return
(
mrb_int
)(
y
-
ys
)
;
}
return
-
1
;
}
...
...
@@ -372,7 +373,7 @@ mrb_memsearch(const void *x0, mrb_int m, const void *y0, mrb_int n)
const
unsigned
char
*
ys
=
(
const
unsigned
char
*
)
memchr
(
y
,
*
x
,
n
);
if
(
ys
)
return
ys
-
y
;
return
(
mrb_int
)(
ys
-
y
)
;
else
return
-
1
;
}
...
...
@@ -585,7 +586,7 @@ str_rindex(mrb_state *mrb, mrb_value str, mrb_value sub, mrb_int pos)
if
(
len
)
{
while
(
sbeg
<=
s
)
{
if
(
memcmp
(
s
,
t
,
len
)
==
0
)
{
return
s
-
RSTR_PTR
(
ps
);
return
(
mrb_int
)(
s
-
RSTR_PTR
(
ps
)
);
}
s
--
;
}
...
...
src/vm.c
View file @
0ff28c9e
...
...
@@ -223,7 +223,7 @@ uvenv(mrb_state *mrb, int up)
static
inline
mrb_bool
is_strict
(
mrb_state
*
mrb
,
struct
REnv
*
e
)
{
in
t
cioff
=
e
->
cioff
;
ptrdiff_
t
cioff
=
e
->
cioff
;
if
(
MRB_ENV_STACK_SHARED_P
(
e
)
&&
e
->
cxt
.
c
->
cibase
[
cioff
].
proc
&&
MRB_PROC_STRICT_P
(
e
->
cxt
.
c
->
cibase
[
cioff
].
proc
))
{
...
...
@@ -732,7 +732,7 @@ mrb_yield_with_class(mrb_state *mrb, mrb_value b, mrb_int argc, const mrb_value
mrb
->
c
->
stack
=
mrb
->
c
->
ci
->
stackent
;
}
else
{
in
t
cioff
=
mrb
->
c
->
ci
-
mrb
->
c
->
cibase
;
ptrdiff_
t
cioff
=
mrb
->
c
->
ci
-
mrb
->
c
->
cibase
;
val
=
mrb_run
(
mrb
,
p
,
self
);
mrb
->
c
->
ci
=
mrb
->
c
->
cibase
+
cioff
;
}
...
...
@@ -903,7 +903,7 @@ mrb_vm_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int stac
mrb_irep
*
irep
=
proc
->
body
.
irep
;
mrb_value
result
;
struct
mrb_context
*
c
=
mrb
->
c
;
in
t
cioff
=
c
->
ci
-
c
->
cibase
;
ptrdiff_
t
cioff
=
c
->
ci
-
c
->
cibase
;
unsigned
int
nregs
=
irep
->
nregs
;
if
(
!
c
->
stack
)
{
...
...
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