Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: remove unnecessary memory allocation



details:   https://anonhg.NetBSD.org/src/rev/a994c713b7e7
branches:  trunk
changeset: 366793:a994c713b7e7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Jun 15 17:57:16 2022 +0000

description:
lint: remove unnecessary memory allocation

No functional change.

diffstat:

 usr.bin/xlint/lint1/decl.c |  14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)

diffs (50 lines):

diff -r 5e78144652b7 -r a994c713b7e7 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Wed Jun 15 16:28:01 2022 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Wed Jun 15 17:57:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.285 2022/06/11 12:23:59 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.286 2022/06/15 17:57:16 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.285 2022/06/11 12:23:59 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.286 2022/06/15 17:57:16 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -51,7 +51,7 @@
 const  char *unnamed = "<unnamed>";
 
 /* shared type structures for arithmetic types and void */
-static type_t  *typetab;
+static type_t  typetab[NTSPEC];
 
 /* value of next enumerator during declaration of enum types */
 int    enumval;
@@ -91,7 +91,6 @@
 #endif
 initdecl(void)
 {
-       int i;
 
        /* declaration stack */
        dcs = xcalloc(1, sizeof(*dcs));
@@ -101,13 +100,8 @@
        /* type information and classification */
        inittyp();
 
-       /* shared type structures */
-       typetab = xcalloc(NTSPEC, sizeof(*typetab));
-       for (i = 0; i < NTSPEC; i++)
-               typetab[i].t_tspec = NOTSPEC;
-
        /*
-        * The following two are not real types. They are only used by the
+        * The following two are not really types. They are only used by the
         * parser to handle the keywords "signed" and "unsigned".
         */
        typetab[SIGNED].t_tspec = SIGNED;



Home | Main Index | Thread Index | Old Index