mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
coccinelle: automatically rewrite memset() to zero() or memzero() where we can
We are pretty good at this already, hence only a single case is actually found by this.
This commit is contained in:
parent
fbd0b64f44
commit
673192494c
30
coccinelle/memzero.cocci
Normal file
30
coccinelle/memzero.cocci
Normal file
@ -0,0 +1,30 @@
|
||||
@@
|
||||
expression s;
|
||||
@@
|
||||
- memset(&s, 0, sizeof(s))
|
||||
+ zero(s)
|
||||
@@
|
||||
expression s;
|
||||
@@
|
||||
- memset(s, 0, sizeof(*s))
|
||||
+ zero(*s)
|
||||
@@
|
||||
expression s;
|
||||
@@
|
||||
- bzero(&s, sizeof(s))
|
||||
+ zero(s)
|
||||
@@
|
||||
expression s;
|
||||
@@
|
||||
- bzero(s, sizeof(*s))
|
||||
+ zero(*s)
|
||||
@@
|
||||
expression a, b;
|
||||
@@
|
||||
- memset(a, 0, b)
|
||||
+ memzero(a, b)
|
||||
@@
|
||||
expression a, b;
|
||||
@@
|
||||
- bzero(a, b)
|
||||
+ memzero(a, b)
|
@ -133,7 +133,7 @@ static int determine_path_usage(Server *s, const char *path, uint64_t *ret_used,
|
||||
}
|
||||
|
||||
static void cache_space_invalidate(JournalStorageSpace *space) {
|
||||
memset(space, 0, sizeof(*space));
|
||||
zero(*space);
|
||||
}
|
||||
|
||||
static int cache_space_refresh(Server *s, JournalStorage *storage) {
|
||||
|
Loading…
Reference in New Issue
Block a user