Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Oct 2020 20:37:05 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r366856 - stable/12/sbin/nvmecontrol
Message-ID:  <202010192037.09JKb5Zq079232@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Oct 19 20:37:04 2020
New Revision: 366856
URL: https://svnweb.freebsd.org/changeset/base/366856

Log:
  MFC r352212 (by imp):
  Assume all the short args have optional args so allocate space for the
  ':'. It's slightly wasteful, but much easier (and the savings in bytes
  at runtime would be tiny, but the code to do it larger).

Modified:
  stable/12/sbin/nvmecontrol/comnd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/nvmecontrol/comnd.c
==============================================================================
--- stable/12/sbin/nvmecontrol/comnd.c	Mon Oct 19 20:26:37 2020	(r366855)
+++ stable/12/sbin/nvmecontrol/comnd.c	Mon Oct 19 20:37:04 2020	(r366856)
@@ -189,7 +189,7 @@ arg_parse(int argc, char * const * argv, const struct 
 	lopts = malloc((n + 2) * sizeof(struct option));
 	if (lopts == NULL)
 		err(1, "option memory");
-	p = shortopts = malloc((n + 3) * sizeof(char));
+	p = shortopts = malloc((2 * n + 3) * sizeof(char));
 	if (shortopts == NULL)
 		err(1, "shortopts memory");
 	idx = 0;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202010192037.09JKb5Zq079232>