Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint/lint2 lint: move xalloc to the only file where...
details: https://anonhg.NetBSD.org/src/rev/8da8b367660a
branches: trunk
changeset: 373028:8da8b367660a
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Jan 13 19:50:00 2023 +0000
description:
lint: move xalloc to the only file where it is used
No functional change.
diffstat:
usr.bin/xlint/lint2/Makefile | 4 +-
usr.bin/xlint/lint2/externs2.h | 7 +----
usr.bin/xlint/lint2/mem2.c | 55 ------------------------------------------
usr.bin/xlint/lint2/read.c | 14 +++++++++-
4 files changed, 15 insertions(+), 65 deletions(-)
diffs (130 lines):
diff -r d7584569188d -r 8da8b367660a usr.bin/xlint/lint2/Makefile
--- a/usr.bin/xlint/lint2/Makefile Fri Jan 13 19:45:45 2023 +0000
+++ b/usr.bin/xlint/lint2/Makefile Fri Jan 13 19:50:00 2023 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.22 2021/08/22 15:06:49 rillig Exp $
+# $NetBSD: Makefile,v 1.23 2023/01/13 19:50:00 rillig Exp $
NOMAN= # defined
PROG= lint2
-SRCS= main2.c hash.c read.c mem.c mem2.c chk.c msg.c emit.c emit2.c \
+SRCS= main2.c hash.c read.c mem.c chk.c msg.c emit.c emit2.c \
inittyp.c tyname.c
BINDIR= /usr/libexec
CPPFLAGS+= -I${.CURDIR}
diff -r d7584569188d -r 8da8b367660a usr.bin/xlint/lint2/externs2.h
--- a/usr.bin/xlint/lint2/externs2.h Fri Jan 13 19:45:45 2023 +0000
+++ b/usr.bin/xlint/lint2/externs2.h Fri Jan 13 19:50:00 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: externs2.h,v 1.17 2023/01/13 19:41:50 rillig Exp $ */
+/* $NetBSD: externs2.h,v 1.18 2023/01/13 19:50:00 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -67,11 +67,6 @@
extern void mkstatic(hte_t *);
/*
- * mem2.c
- */
-extern void *xalloc(size_t);
-
-/*
* chk.c
*/
extern void mainused(void);
diff -r d7584569188d -r 8da8b367660a usr.bin/xlint/lint2/mem2.c
--- a/usr.bin/xlint/lint2/mem2.c Fri Jan 13 19:45:45 2023 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/* $NetBSD: mem2.c,v 1.16 2023/01/13 19:41:50 rillig Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Jochen Pohl
- * All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Jochen Pohl for
- * The NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-#if defined(__RCSID)
-__RCSID("$NetBSD: mem2.c,v 1.16 2023/01/13 19:41:50 rillig Exp $");
-#endif
-
-#include <string.h>
-
-#include "lint2.h"
-
-/* Allocate zero-initialized memory that doesn't need to be freed. */
-void *
-xalloc(size_t sz)
-{
-
- void *ptr = xmalloc(sz);
- (void)memset(ptr, 0, sz);
- return ptr;
-}
diff -r d7584569188d -r 8da8b367660a usr.bin/xlint/lint2/read.c
--- a/usr.bin/xlint/lint2/read.c Fri Jan 13 19:45:45 2023 +0000
+++ b/usr.bin/xlint/lint2/read.c Fri Jan 13 19:50:00 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.76 2022/05/20 21:18:55 rillig Exp $ */
+/* $NetBSD: read.c,v 1.77 2023/01/13 19:50:00 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: read.c,v 1.76 2022/05/20 21:18:55 rillig Exp $");
+__RCSID("$NetBSD: read.c,v 1.77 2023/01/13 19:50:00 rillig Exp $");
#endif
#include <ctype.h>
@@ -108,6 +108,16 @@
static const char *inpname(const char *, const char **);
static int getfnidx(const char *);
+/* Allocate zero-initialized memory that doesn't need to be freed. */
+static void *
+xalloc(size_t sz)
+{
+
+ void *ptr = xmalloc(sz);
+ (void)memset(ptr, 0, sz);
+ return ptr;
+}
+
static bool
try_parse_int(const char **p, int *num)
{
Home |
Main Index |
Thread Index |
Old Index