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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to