Module Name: src
Committed By: rillig
Date: Sat Jan 20 10:21:35 UTC 2024
Modified Files:
src/usr.bin/xlint/common: externs.h mem.c
Log Message:
lint: only define xcalloc if actually used
To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/xlint/common/mem.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/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.31 src/usr.bin/xlint/common/externs.h:1.32
--- src/usr.bin/xlint/common/externs.h:1.31 Sun Dec 3 18:17:41 2023
+++ src/usr.bin/xlint/common/externs.h Sat Jan 20 10:21:35 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: externs.h,v 1.31 2023/12/03 18:17:41 rillig Exp $ */
+/* $NetBSD: externs.h,v 1.32 2024/01/20 10:21:35 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -43,7 +43,9 @@ const char *tspec_name(tspec_t);
* mem.c
*/
void *xmalloc(size_t);
+#if defined(IS_LINT1) || defined(IS_LINT2)
void *xcalloc(size_t, size_t);
+#endif
void *xrealloc(void *, size_t);
char *xstrdup(const char *);
char *xasprintf(const char *, ...) __printflike(1, 2);
Index: src/usr.bin/xlint/common/mem.c
diff -u src/usr.bin/xlint/common/mem.c:1.22 src/usr.bin/xlint/common/mem.c:1.23
--- src/usr.bin/xlint/common/mem.c:1.22 Thu Jul 13 08:40:38 2023
+++ src/usr.bin/xlint/common/mem.c Sat Jan 20 10:21:35 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mem.c,v 1.22 2023/07/13 08:40:38 rillig Exp $ */
+/* $NetBSD: mem.c,v 1.23 2024/01/20 10:21:35 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID)
-__RCSID("$NetBSD: mem.c,v 1.22 2023/07/13 08:40:38 rillig Exp $");
+__RCSID("$NetBSD: mem.c,v 1.23 2024/01/20 10:21:35 rillig Exp $");
#endif
#include <stdarg.h>
@@ -62,12 +62,14 @@ xmalloc(size_t s)
return not_null(malloc(s));
}
+#if defined(IS_LINT1) || defined(IS_LINT2)
void *
xcalloc(size_t n, size_t s)
{
return not_null(calloc(n, s));
}
+#endif
void *
xrealloc(void *p, size_t s)