PR/50909: David Binderman: Optimize memset

This commit is contained in:
christos 2016-03-07 15:56:17 +00:00
parent 161a4d81ea
commit 89e8cc1112
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: env.c,v 1.10 2016/03/07 12:48:53 christos Exp $ */
/* $NetBSD: env.c,v 1.11 2016/03/07 15:56:17 christos Exp $ */
/*-
* Copyright (c) 2008 David Young. All rights reserved.
@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: env.c,v 1.10 2016/03/07 12:48:53 christos Exp $");
__RCSID("$NetBSD: env.c,v 1.11 2016/03/07 15:56:17 christos Exp $");
#endif /* not lint */
#include <errno.h>
@ -141,8 +141,8 @@ getargdata(prop_dictionary_t env, const char *key, uint8_t *buf, size_t buflen)
errno = ENAMETOOLONG;
return -1;
}
memset(buf, 0, buflen);
memcpy(buf, prop_data_data_nocopy(data), datalen);
memset(buf + datalen, 0, buflen - datalen);
return datalen;
}