Date: Wed, 27 Jan 2016 19:55:03 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294934 - head/sys/kern Message-ID: <201601271955.u0RJt3Jk073845@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Wed Jan 27 19:55:02 2016 New Revision: 294934 URL: https://svnweb.freebsd.org/changeset/base/294934 Log: ktrace: tidy up ktrstruct - minor style fixes - avoid doing strlen twice [1] PR: 206648 Submitted by: C Turt <ecturt gmail.com> (original version) [1] Modified: head/sys/kern/kern_ktrace.c Modified: head/sys/kern/kern_ktrace.c ============================================================================== --- head/sys/kern/kern_ktrace.c Wed Jan 27 19:11:11 2016 (r294933) +++ head/sys/kern/kern_ktrace.c Wed Jan 27 19:55:02 2016 (r294934) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601271955.u0RJt3Jk073845>