ktrace: tidy up ktrstruct
- minor style fixes - avoid doing strlen twice [1] PR: 206648 Submitted by: C Turt <ecturt gmail.com> (original version) [1]
This commit is contained in:
parent
fac4a7ac31
commit
4dd3a21fb3
@ -757,15 +757,16 @@ ktrstruct(name, data, datalen)
|
||||
size_t datalen;
|
||||
{
|
||||
struct ktr_request *req;
|
||||
char *buf = NULL;
|
||||
size_t buflen;
|
||||
char *buf;
|
||||
size_t buflen, namelen;
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
datalen = 0;
|
||||
buflen = strlen(name) + 1 + datalen;
|
||||
namelen = strlen(name) + 1;
|
||||
buflen = namelen + datalen;
|
||||
buf = malloc(buflen, M_KTRACE, M_WAITOK);
|
||||
strcpy(buf, name);
|
||||
bcopy(data, buf + strlen(name) + 1, datalen);
|
||||
bcopy(data, buf + namelen, datalen);
|
||||
if ((req = ktr_getrequest(KTR_STRUCT)) == NULL) {
|
||||
free(buf, M_KTRACE);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user