git: f02c78375736 - main - sort: use memset to initialize structure when possible
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 13 Oct 2022 08:24:19 UTC
The branch main has been updated by bapt:
URL: https://cgit.FreeBSD.org/src/commit/?id=f02c783757365340763739e58ef0e68ec13a0f8f
commit f02c783757365340763739e58ef0e68ec13a0f8f
Author: Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2022-10-13 07:07:46 +0000
Commit: Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2022-10-13 08:24:11 +0000
sort: use memset to initialize structure when possible
---
usr.bin/sort/file.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/usr.bin/sort/file.c b/usr.bin/sort/file.c
index 3e5754442ac1..92371d7a15b2 100644
--- a/usr.bin/sort/file.c
+++ b/usr.bin/sort/file.c
@@ -216,9 +216,7 @@ file_list_init(struct file_list *fl, bool tmp)
{
if (fl) {
- fl->count = 0;
- fl->sz = 0;
- fl->fns = NULL;
+ memset(fl, 0, sizeof(*fl));
fl->tmp = tmp;
}
}
@@ -293,10 +291,8 @@ sort_list_init(struct sort_list *l)
{
if (l) {
- l->count = 0;
- l->size = 0;
+ memset(l, 0, sizeof(*l));
l->memsize = sizeof(struct sort_list);
- l->list = NULL;
}
}