From nobody Thu Apr 11 18:27:52 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VFp8n0N6Qz5HrvB; Thu, 11 Apr 2024 18:27:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VFp8m70frz4fCX; Thu, 11 Apr 2024 18:27:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712860073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lvV40lwL/j86KIklOgTkHjIa6fCLufY+Z4KtsQ6ivl4=; b=VLnUsgtR1sdfdVsk5Pr8dn6S3AnwTI452zpnUe1KJmnbt/fW2ukrc3fr8MnmrRqQ5NDMlk Fd4WFaqcw3TUH1G9b+C9YIg0cO3juKWvlmmkvxrF6BgLF4qVBwGjSmoIlA6zldz1MkaHye 1F1rSJiQN3EoLzuh4BR55Ll8+z50kKjzIP+waz3OJxAGC7BM1LuxbQxKIzVDnjAjoGktNb XmwaVlYYfSgmm8INKVWY8uj75pxajwaF/e5I+ku6srEv0PhplexoIFLnNmy6KlzzT4W+eG p34IjNrL7EKrReEG7BbdNCSZL6MeHmGMDN3EhTXIOQMVva9Nc6Kcz7dtJsDovA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712860073; a=rsa-sha256; cv=none; b=VUElTuBsLZF2T90xUP0ONsCyTdOUtYO0zBTxJ+wxU1z6BVgMKSlaTZ1hWKXqbQchjMy4Kf pmjg7Jw8Ng1WGNlZQnRhStPlHk5KJ7+L0csKm9IYZa8UhjO66TepHER5J/lu4k1KJj70IV gsFd6Hr4P3Aabi9vKeSqCbDc+poar4ckpIWjyyeIJdUms3UufEJQpcW7MEZOJUtqxChf8k jOiVmdqg1qSb3a6PyH27Wrc+5kN7JZ9/VWFbK/jc/LHac4DWxsSnv06N85pyII1m4joOn5 MHCFoYzyYRAMqJXC2gmWlQsip4jm1B47VUfDticDsYItFjCZP/ro0uq57jxyxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712860073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lvV40lwL/j86KIklOgTkHjIa6fCLufY+Z4KtsQ6ivl4=; b=F0nm+IEq16P4tgKGNbnM88tDrBdos7ZyylNZ3nZV9HiafB7lk3Nt4UR93Q8QjITqWP16Oa jNmj6CUuhK14ezYZLdiLxn0IR/f3QaL68VfGETCd0MqPHOM1w6CvRwBzD2zXO3MS9l0XBl fIabgBO/uVscaylcbb9crYm6NiGsL/cUUmdudDtxTAFIxW9t7A1HEdwsKjbWkwht9xi7pQ 5O1OZwVWSXm8TV9ecp+lPYd5G5qXvu3zQoU7KWVu3UJdt9lw+P6N9y8Vr3GO+iVQWGQhAD bGQD8Gua5wNh3Yy3xOTRFvXWDShWfCE72AkABYnqlQuSPdiy76ZT7xH7L4IrUQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VFp8m6c2dzGxw; Thu, 11 Apr 2024 18:27:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43BIRqYr055899; Thu, 11 Apr 2024 18:27:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43BIRq0J055896; Thu, 11 Apr 2024 18:27:52 GMT (envelope-from git) Date: Thu, 11 Apr 2024 18:27:52 GMT Message-Id: <202404111827.43BIRq0J055896@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 16e5eb212fb8 - main - fdwrite.c: initialize pointers to NULL and a few other cleanups List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: dev-commits-src-all+owner@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 16e5eb212fb8e054513adafa6c44db23f27dbb46 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=16e5eb212fb8e054513adafa6c44db23f27dbb46 commit 16e5eb212fb8e054513adafa6c44db23f27dbb46 Author: rilysh AuthorDate: 2024-04-11 18:23:33 +0000 Commit: Warner Losh CommitDate: 2024-04-11 18:24:36 +0000 fdwrite.c: initialize pointers to NULL and a few other cleanups 1. Both trackbuf and vrfybuf are initialized to zero (NULL). While it's okay to initialize pointers to zero, to keep consistency, as they're explicitly pointers, it's better to just use NULL ((void *)0) instead of 0 (both are equivalent to the compilers). 2. Call free() for both trackbuf and vrfybuf after their job has been done. 3. Remove the register keyword. Compilers generally ignore this keyword (except for very very old compilers and CPUs). 4. Remove the ctype.h header. It's not being used anywhere in the file. Signed-off-by: rilysh Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1059 --- usr.sbin/fdwrite/fdwrite.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.sbin/fdwrite/fdwrite.c b/usr.sbin/fdwrite/fdwrite.c index 4c91ae2599c6..94052028c6dc 100644 --- a/usr.sbin/fdwrite/fdwrite.c +++ b/usr.sbin/fdwrite/fdwrite.c @@ -10,7 +10,6 @@ * */ -#include #include #include #include @@ -26,7 +25,7 @@ format_track(int fd, int cyl, int secs, int head, int rate, int gaplen, int secsize, int fill, int interleave) { struct fd_formb f; - register int i,j; + int i, j; int il[100]; memset(il,0,sizeof il); @@ -68,7 +67,7 @@ main(int argc, char **argv) int bpt, verbose=1, nbytes=0, track; int interactive = 1; const char *device= "/dev/fd0"; - char *trackbuf = 0,*vrfybuf = 0; + char *trackbuf = NULL, *vrfybuf = NULL; struct fd_type fdt; FILE *tty; @@ -192,5 +191,8 @@ main(int argc, char **argv) } if(verbose) printf("%d bytes on %d flopp%s\n",nbytes,fdn,fdn==1?"y":"ies"); + + free(trackbuf); + free(vrfybuf); exit(0); }