PR/50908: David Binderman: Optimize memset's
This commit is contained in:
parent
95e3bb37fd
commit
85e7d45a39
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: dir.c,v 1.27 2015/01/02 06:21:28 mlelstv Exp $ */
|
/* $NetBSD: dir.c,v 1.28 2016/03/07 14:47:25 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
|
* Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
__RCSID("$NetBSD: dir.c,v 1.27 2015/01/02 06:21:28 mlelstv Exp $");
|
__RCSID("$NetBSD: dir.c,v 1.28 2016/03/07 14:47:25 christos Exp $");
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -929,6 +929,7 @@ int
|
||||||
reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
|
reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
|
||||||
{
|
{
|
||||||
struct dosDirEntry d;
|
struct dosDirEntry d;
|
||||||
|
int len;
|
||||||
u_char *p;
|
u_char *p;
|
||||||
|
|
||||||
if (!ask(1, "Reconnect"))
|
if (!ask(1, "Reconnect"))
|
||||||
|
@ -980,14 +981,15 @@ reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
|
||||||
boot->NumFiles++;
|
boot->NumFiles++;
|
||||||
/* Ensure uniqueness of entry here! XXX */
|
/* Ensure uniqueness of entry here! XXX */
|
||||||
memset(&d, 0, sizeof d);
|
memset(&d, 0, sizeof d);
|
||||||
(void)snprintf(d.name, sizeof(d.name), "%u", head);
|
/* worst case -1 = 4294967295, 10 digits */
|
||||||
|
len = snprintf(d.name, sizeof(d.name), "%u", head);
|
||||||
d.flags = 0;
|
d.flags = 0;
|
||||||
d.head = head;
|
d.head = head;
|
||||||
d.size = fat[head].length * boot->ClusterSize;
|
d.size = fat[head].length * boot->ClusterSize;
|
||||||
|
|
||||||
memset(p, 0, 32);
|
memcpy(p, d.name, len);
|
||||||
memset(p, ' ', 11);
|
memset(p + len, ' ', 11 - len);
|
||||||
memcpy(p, d.name, strlen(d.name));
|
memset(p + 11, 0, 32 - 11);
|
||||||
p[26] = (u_char)d.head;
|
p[26] = (u_char)d.head;
|
||||||
p[27] = (u_char)(d.head >> 8);
|
p[27] = (u_char)(d.head >> 8);
|
||||||
if (boot->ClustMask == CLUST32_MASK) {
|
if (boot->ClustMask == CLUST32_MASK) {
|
||||||
|
|
Loading…
Reference in New Issue