PR/50910: David Binderman: Optimize memset.
This commit is contained in:
parent
60d995df79
commit
161a4d81ea
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mkfs.c,v 1.126 2016/03/07 15:09:55 dholland Exp $ */
|
||||
/* $NetBSD: mkfs.c,v 1.127 2016/03/07 15:55:06 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1989, 1993
|
||||
@ -73,7 +73,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mkfs.c,v 1.126 2016/03/07 15:09:55 dholland Exp $");
|
||||
__RCSID("$NetBSD: mkfs.c,v 1.127 2016/03/07 15:55:06 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -735,8 +735,10 @@ mkfs(const char *fsys, int fi, int fo,
|
||||
* Write out the super-block and zeros until the first cg info
|
||||
*/
|
||||
i = cgsblock(&sblock, 0) * sblock.fs_fsize - sblock.fs_sblockloc;
|
||||
memset(iobuf, 0, i);
|
||||
memcpy(iobuf, &sblock, sizeof sblock);
|
||||
if ((size_t)i < sizeof(sblock))
|
||||
errx(1, "No space for superblock");
|
||||
memcpy(iobuf, &sblock, sizeof(sblock));
|
||||
memset(iobuf + sizeof(sblock), 0, i - sizeof(sblock));
|
||||
if (needswap)
|
||||
ffs_sb_swap(&sblock, (struct fs *)iobuf);
|
||||
if ((sblock.fs_old_flags & FS_FLAGS_UPDATED) == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user