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
8619ba6a
Unverified
Commit
8619ba6a
authored
Sep 15, 2021
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `struct` initializer instead of `memset`.
parent
e5e7bd29
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
13 additions
and
19 deletions
+13
-19
mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c
mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c
+2
-2
mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c
mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c
+1
-1
mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c
mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c
+2
-2
mrbgems/mruby-fiber/src/fiber.c
mrbgems/mruby-fiber/src/fiber.c
+0
-4
mrbgems/mruby-io/src/file.c
mrbgems/mruby-io/src/file.c
+1
-1
mrbgems/mruby-socket/src/socket.c
mrbgems/mruby-socket/src/socket.c
+4
-4
src/class.c
src/class.c
+3
-1
src/vm.c
src/vm.c
+0
-4
No files found.
mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c
View file @
8619ba6a
...
...
@@ -344,10 +344,10 @@ mrb_debug_delete_break(mrb_state *mrb, mrb_debug_context *dbg, uint32_t bpno)
for
(
i
=
index
;
i
<
dbg
->
bpnum
;
i
++
)
{
if
((
i
+
1
)
==
dbg
->
bpnum
)
{
memset
(
&
dbg
->
bp
[
i
],
0
,
sizeof
(
mrb_debug_breakpoint
))
;
dbg
->
bp
[
i
]
=
(
mrb_debug_breakpoint
){
0
}
;
}
else
{
memcpy
(
&
dbg
->
bp
[
i
],
&
dbg
->
bp
[
i
+
1
],
sizeof
(
mrb_debug_breakpoint
))
;
dbg
->
bp
[
i
]
=
dbg
->
bp
[
i
+
1
]
;
}
}
...
...
mrbgems/mruby-bin-debugger/tools/mrdb/cmdmisc.c
View file @
8619ba6a
...
...
@@ -141,7 +141,7 @@ static listcmd_parser_state*
listcmd_parser_state_new
(
mrb_state
*
mrb
)
{
listcmd_parser_state
*
st
=
(
listcmd_parser_state
*
)
mrb_malloc
(
mrb
,
sizeof
(
listcmd_parser_state
));
memset
(
st
,
0
,
sizeof
(
listcmd_parser_state
))
;
*
st
=
(
listcmd_parser_state
){
0
}
;
return
st
;
}
...
...
mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c
View file @
8619ba6a
...
...
@@ -187,7 +187,7 @@ mrb_debug_context_new(mrb_state *mrb)
{
mrb_debug_context
*
dbg
=
(
mrb_debug_context
*
)
mrb_malloc
(
mrb
,
sizeof
(
mrb_debug_context
));
memset
(
dbg
,
0
,
sizeof
(
mrb_debug_context
))
;
*
dbg
=
(
mrb_debug_context
){
0
}
;
dbg
->
xm
=
DBG_INIT
;
dbg
->
xphase
=
DBG_PHASE_BEFORE_RUN
;
...
...
@@ -226,7 +226,7 @@ mrdb_state_new(mrb_state *mrb)
{
mrdb_state
*
mrdb
=
(
mrdb_state
*
)
mrb_malloc
(
mrb
,
sizeof
(
mrdb_state
));
memset
(
mrdb
,
0
,
sizeof
(
mrdb_state
))
;
*
mrdb
=
(
mrdb_state
){
0
}
;
mrdb
->
dbg
=
mrb_debug_context_get
(
mrb
);
mrdb
->
command
=
(
char
*
)
mrb_malloc
(
mrb
,
MAX_COMMAND_LINE
+
1
);
...
...
mrbgems/mruby-fiber/src/fiber.c
View file @
8619ba6a
...
...
@@ -95,7 +95,6 @@ fiber_init(mrb_state *mrb, mrb_value self)
c
->
stbase
=
(
mrb_value
*
)
mrb_malloc
(
mrb
,
slen
*
sizeof
(
mrb_value
));
c
->
stend
=
c
->
stbase
+
slen
;
#ifdef MRB_NAN_BOXING
{
mrb_value
*
p
=
c
->
stbase
;
mrb_value
*
pend
=
c
->
stend
;
...
...
@@ -105,9 +104,6 @@ fiber_init(mrb_state *mrb, mrb_value self)
p
++
;
}
}
#else
memset
(
c
->
stbase
,
0
,
slen
*
sizeof
(
mrb_value
));
#endif
/* copy receiver from a block */
c
->
stbase
[
0
]
=
mrb
->
c
->
ci
->
stack
[
0
];
...
...
mrbgems/mruby-io/src/file.c
View file @
8619ba6a
...
...
@@ -88,7 +88,7 @@ flock(int fd, int operation) {
DWORD
flags
;
flags
=
((
operation
&
LOCK_NB
)
?
LOCKFILE_FAIL_IMMEDIATELY
:
0
)
|
((
operation
&
LOCK_SH
)
?
LOCKFILE_EXCLUSIVE_LOCK
:
0
);
memset
(
&
ov
,
0
,
sizeof
(
ov
))
;
ov
=
(
OVERLAPPED
){
0
}
;
return
LockFileEx
(
h
,
flags
,
0
,
0xffffffff
,
0xffffffff
,
&
ov
)
?
0
:
-
1
;
}
#endif
...
...
mrbgems/mruby-socket/src/socket.c
View file @
8619ba6a
...
...
@@ -67,7 +67,7 @@ static const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt)
if
(
af
==
AF_INET
)
{
struct
sockaddr_in
in
;
memset
(
&
in
,
0
,
sizeof
(
in
))
;
in
=
(
struct
sockaddr_in
){
0
}
;
in
.
sin_family
=
AF_INET
;
memcpy
(
&
in
.
sin_addr
,
src
,
sizeof
(
struct
in_addr
));
getnameinfo
((
struct
sockaddr
*
)
&
in
,
sizeof
(
struct
...
...
@@ -77,7 +77,7 @@ static const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt)
else
if
(
af
==
AF_INET6
)
{
struct
sockaddr_in6
in
;
memset
(
&
in
,
0
,
sizeof
(
in
))
;
in
=
(
struct
sockaddr_in6
){
0
}
;
in
.
sin6_family
=
AF_INET6
;
memcpy
(
&
in
.
sin6_addr
,
src
,
sizeof
(
struct
in_addr6
));
getnameinfo
((
struct
sockaddr
*
)
&
in
,
sizeof
(
struct
...
...
@@ -91,7 +91,7 @@ static int inet_pton(int af, const char *src, void *dst)
{
struct
addrinfo
hints
,
*
res
,
*
ressave
;
memset
(
&
hints
,
0
,
sizeof
(
struct
addrinfo
))
;
hints
=
(
struct
addrinfo
){
0
}
;
hints
.
ai_family
=
af
;
if
(
getaddrinfo
(
src
,
NULL
,
&
hints
,
&
res
)
!=
0
)
...
...
@@ -148,7 +148,7 @@ mrb_addrinfo_getaddrinfo(mrb_state *mrb, mrb_value klass)
mrb_raise
(
mrb
,
E_TYPE_ERROR
,
"service must be String, Integer, or nil"
);
}
memset
(
&
hints
,
0
,
sizeof
(
hints
))
;
hints
=
(
struct
addrinfo
){
0
}
;
hints
.
ai_flags
=
(
int
)
flags
;
if
(
mrb_integer_p
(
family
))
{
...
...
src/class.c
View file @
8619ba6a
...
...
@@ -1698,7 +1698,9 @@ mrb_define_module_function(mrb_state *mrb, struct RClass *c, const char *name, m
static
void
mc_clear
(
mrb_state
*
mrb
)
{
memset
(
mrb
->
cache
,
0
,
MRB_METHOD_CACHE_SIZE
*
sizeof
(
mrb
->
cache
[
0
]));
for
(
int
i
=
0
;
i
<
MRB_METHOD_CACHE_SIZE
;
i
++
)
{
mrb
->
cache
[
i
]
=
(
struct
mrb_cache_entry
){
0
};
}
}
void
...
...
src/vm.c
View file @
8619ba6a
...
...
@@ -86,14 +86,10 @@ void mrb_method_missing(mrb_state *mrb, mrb_sym name, mrb_value self, mrb_value
static
inline
void
stack_clear
(
mrb_value
*
from
,
size_t
count
)
{
#ifdef MRB_NAN_BOXING
while
(
count
--
>
0
)
{
SET_NIL_VALUE
(
*
from
);
from
++
;
}
#else
memset
(
from
,
0
,
sizeof
(
mrb_value
)
*
count
);
#endif
}
static
inline
void
...
...
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