Module Name: src Committed By: rillig Date: Fri Jan 13 19:50:00 UTC 2023
Modified Files: src/usr.bin/xlint/lint2: Makefile externs2.h read.c Removed Files: src/usr.bin/xlint/lint2: mem2.c Log Message: lint: move xalloc to the only file where it is used No functional change. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/lint2/Makefile cvs rdiff -u -r1.17 -r1.18 src/usr.bin/xlint/lint2/externs2.h cvs rdiff -u -r1.16 -r0 src/usr.bin/xlint/lint2/mem2.c cvs rdiff -u -r1.76 -r1.77 src/usr.bin/xlint/lint2/read.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/xlint/lint2/Makefile diff -u src/usr.bin/xlint/lint2/Makefile:1.22 src/usr.bin/xlint/lint2/Makefile:1.23 --- src/usr.bin/xlint/lint2/Makefile:1.22 Sun Aug 22 15:06:49 2021 +++ src/usr.bin/xlint/lint2/Makefile Fri Jan 13 19:50:00 2023 @@ -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} Index: src/usr.bin/xlint/lint2/externs2.h diff -u src/usr.bin/xlint/lint2/externs2.h:1.17 src/usr.bin/xlint/lint2/externs2.h:1.18 --- src/usr.bin/xlint/lint2/externs2.h:1.17 Fri Jan 13 19:41:50 2023 +++ src/usr.bin/xlint/lint2/externs2.h Fri Jan 13 19:50:00 2023 @@ -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 readfile(const char *); extern void mkstatic(hte_t *); /* - * mem2.c - */ -extern void *xalloc(size_t); - -/* * chk.c */ extern void mainused(void); Index: src/usr.bin/xlint/lint2/read.c diff -u src/usr.bin/xlint/lint2/read.c:1.76 src/usr.bin/xlint/lint2/read.c:1.77 --- src/usr.bin/xlint/lint2/read.c:1.76 Fri May 20 21:18:55 2022 +++ src/usr.bin/xlint/lint2/read.c Fri Jan 13 19:50:00 2023 @@ -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 char *inpqstrg(const char *, cons 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) {