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
fbbe6309
Commit
fbbe6309
authored
Mar 05, 2013
by
kano4
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace tabs with spaces
parent
83c5274a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
40 deletions
+40
-40
src/crc.c
src/crc.c
+1
-1
src/string.c
src/string.c
+3
-3
src/variable.c
src/variable.c
+33
-33
src/vm.c
src/vm.c
+3
-3
No files found.
src/crc.c
View file @
fbbe6309
...
...
@@ -19,7 +19,7 @@ uint16_t
calc_crc_16_ccitt
(
unsigned
char
*
src
,
int
nbytes
)
{
uint32_t
crcwk
=
0ul
;
int
ibyte
,
ibit
;
int
ibyte
,
ibit
;
for
(
ibyte
=
0
;
ibyte
<
nbytes
;
ibyte
++
)
{
crcwk
|=
*
src
++
;
...
...
src/string.c
View file @
fbbe6309
...
...
@@ -62,7 +62,7 @@ str_modify(mrb_state *mrb, struct RString *s)
len
=
s
->
len
;
ptr
=
(
char
*
)
mrb_malloc
(
mrb
,
len
+
1
);
if
(
p
)
{
memcpy
(
ptr
,
p
,
len
);
memcpy
(
ptr
,
p
,
len
);
}
ptr
[
len
]
=
0
;
s
->
ptr
=
ptr
;
...
...
@@ -931,8 +931,8 @@ mrb_str_chomp_bang(mrb_state *mrb, mrb_value str)
if
(
s
->
ptr
[
len
-
1
]
==
'\n'
)
{
s
->
len
--
;
if
(
s
->
len
>
0
&&
s
->
ptr
[
s
->
len
-
1
]
==
'\r'
)
{
s
->
len
--
;
s
->
ptr
[
s
->
len
-
1
]
==
'\r'
)
{
s
->
len
--
;
}
}
else
if
(
s
->
ptr
[
len
-
1
]
==
'\r'
)
{
...
...
src/variable.c
View file @
fbbe6309
...
...
@@ -60,19 +60,19 @@ iv_put(mrb_state *mrb, iv_tbl *t, mrb_sym sym, mrb_value val)
mrb_sym
key
=
seg
->
key
[
i
];
/* found room in last segment after last_len */
if
(
!
seg
->
next
&&
i
>=
t
->
last_len
)
{
seg
->
key
[
i
]
=
sym
;
seg
->
val
[
i
]
=
val
;
t
->
last_len
=
i
+
1
;
t
->
size
++
;
return
;
seg
->
key
[
i
]
=
sym
;
seg
->
val
[
i
]
=
val
;
t
->
last_len
=
i
+
1
;
t
->
size
++
;
return
;
}
if
(
!
matched_seg
&&
key
==
0
)
{
matched_seg
=
seg
;
matched_idx
=
i
;
matched_seg
=
seg
;
matched_idx
=
i
;
}
else
if
(
key
==
sym
)
{
seg
->
val
[
i
]
=
val
;
return
;
seg
->
val
[
i
]
=
val
;
return
;
}
}
prev
=
seg
;
...
...
@@ -114,11 +114,11 @@ iv_get(mrb_state *mrb, iv_tbl *t, mrb_sym sym, mrb_value *vp)
mrb_sym
key
=
seg
->
key
[
i
];
if
(
!
seg
->
next
&&
i
>=
t
->
last_len
)
{
return
FALSE
;
return
FALSE
;
}
if
(
key
==
sym
)
{
if
(
vp
)
*
vp
=
seg
->
val
[
i
];
return
TRUE
;
if
(
vp
)
*
vp
=
seg
->
val
[
i
];
return
TRUE
;
}
}
seg
=
seg
->
next
;
...
...
@@ -138,13 +138,13 @@ iv_del(mrb_state *mrb, iv_tbl *t, mrb_sym sym, mrb_value *vp)
mrb_sym
key
=
seg
->
key
[
i
];
if
(
!
seg
->
next
&&
i
>=
t
->
last_len
)
{
return
FALSE
;
return
FALSE
;
}
if
(
key
==
sym
)
{
t
->
size
--
;
seg
->
key
[
i
]
=
0
;
if
(
vp
)
*
vp
=
seg
->
val
[
i
];
return
TRUE
;
t
->
size
--
;
seg
->
key
[
i
]
=
0
;
if
(
vp
)
*
vp
=
seg
->
val
[
i
];
return
TRUE
;
}
}
seg
=
seg
->
next
;
...
...
@@ -165,15 +165,15 @@ iv_foreach(mrb_state *mrb, iv_tbl *t, iv_foreach_func *func, void *p)
/* no value in last segment after last_len */
if
(
!
seg
->
next
&&
i
>=
t
->
last_len
)
{
return
FALSE
;
return
FALSE
;
}
if
(
key
!=
0
)
{
n
=
(
*
func
)(
mrb
,
key
,
seg
->
val
[
i
],
p
);
if
(
n
>
0
)
return
FALSE
;
if
(
n
<
0
)
{
t
->
size
--
;
seg
->
key
[
i
]
=
0
;
}
n
=
(
*
func
)(
mrb
,
key
,
seg
->
val
[
i
],
p
);
if
(
n
>
0
)
return
FALSE
;
if
(
n
<
0
)
{
t
->
size
--
;
seg
->
key
[
i
]
=
0
;
}
}
}
seg
=
seg
->
next
;
...
...
@@ -315,11 +315,11 @@ iv_foreach(mrb_state *mrb, iv_tbl *t, iv_foreach_func *func, void *p)
if
(
h
)
{
for
(
k
=
kh_begin
(
h
);
k
!=
kh_end
(
h
);
k
++
)
{
if
(
kh_exist
(
h
,
k
)){
n
=
(
*
func
)(
mrb
,
kh_key
(
h
,
k
),
kh_value
(
h
,
k
),
p
);
if
(
n
>
0
)
return
FALSE
;
if
(
n
<
0
)
{
kh_del
(
iv
,
h
,
k
);
}
n
=
(
*
func
)(
mrb
,
kh_key
(
h
,
k
),
kh_value
(
h
,
k
),
p
);
if
(
n
>
0
)
return
FALSE
;
if
(
n
<
0
)
{
kh_del
(
iv
,
h
,
k
);
}
}
}
}
...
...
@@ -769,7 +769,7 @@ mrb_vm_cv_set(mrb_state *mrb, mrb_sym sym, mrb_value v)
if
(
iv_get
(
mrb
,
t
,
sym
,
NULL
))
{
mrb_write_barrier
(
mrb
,
(
struct
RBasic
*
)
c
);
iv_put
(
mrb
,
t
,
sym
,
v
);
iv_put
(
mrb
,
t
,
sym
,
v
);
return
;
}
}
...
...
@@ -816,12 +816,12 @@ const_get(mrb_state *mrb, struct RClass *base, mrb_sym sym)
int
retry
=
0
;
mrb_sym
cm
;
L_RETRY:
L_RETRY:
while
(
c
)
{
if
(
c
->
iv
)
{
t
=
c
->
iv
;
if
(
iv_get
(
mrb
,
t
,
sym
,
&
v
))
return
v
;
return
v
;
}
c
=
c
->
super
;
}
...
...
@@ -870,7 +870,7 @@ mrb_vm_const_get(mrb_state *mrb, mrb_sym sym)
c2
=
mrb_class_outer_module
(
mrb
,
c2
);
if
(
!
c2
)
break
;
if
(
c2
->
iv
&&
iv_get
(
mrb
,
c2
->
iv
,
sym
,
&
v
))
{
return
v
;
return
v
;
}
}
}
...
...
src/vm.c
View file @
fbbe6309
...
...
@@ -483,12 +483,12 @@ argnum_error(mrb_state *mrb, int num)
if
(
mrb
->
ci
->
mid
)
{
len
=
snprintf
(
buf
,
sizeof
(
buf
),
"'%s': wrong number of arguments (%d for %d)"
,
mrb_sym2name
(
mrb
,
mrb
->
ci
->
mid
),
mrb
->
ci
->
argc
,
num
);
mrb_sym2name
(
mrb
,
mrb
->
ci
->
mid
),
mrb
->
ci
->
argc
,
num
);
}
else
{
len
=
snprintf
(
buf
,
sizeof
(
buf
),
"wrong number of arguments (%d for %d)"
,
mrb
->
ci
->
argc
,
num
);
mrb
->
ci
->
argc
,
num
);
}
exc
=
mrb_exc_new
(
mrb
,
E_ARGUMENT_ERROR
,
buf
,
len
);
mrb
->
exc
=
(
struct
RObject
*
)
mrb_object
(
exc
);
...
...
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