Module Name: src
Committed By: rillig
Date: Mon Jan 4 22:29:01 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: mem1.c
Log Message:
lint: reduce comment for xgetblk to the actually interesting part
To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/xlint/lint1/mem1.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/lint1/mem1.c
diff -u src/usr.bin/xlint/lint1/mem1.c:1.21 src/usr.bin/xlint/lint1/mem1.c:1.22
--- src/usr.bin/xlint/lint1/mem1.c:1.21 Wed Dec 30 10:46:11 2020
+++ src/usr.bin/xlint/lint1/mem1.c Mon Jan 4 22:29:00 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: mem1.c,v 1.21 2020/12/30 10:46:11 rillig Exp $ */
+/* $NetBSD: mem1.c,v 1.22 2021/01/04 22:29:00 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mem1.c,v 1.21 2020/12/30 10:46:11 rillig Exp $");
+__RCSID("$NetBSD: mem1.c,v 1.22 2021/01/04 22:29:00 rillig Exp $");
#endif
#include <sys/types.h>
@@ -218,14 +218,7 @@ xnewblk(void)
return mb;
}
-/*
- * Allocate new memory. If the first block of the list has not enough
- * free space, or there is no first block, get a new block. The new
- * block is taken from the free list or, if there is no block on the
- * free list, is allocated using xnewblk(). If a new block is allocated
- * it is initialized with zero. Blocks taken from the free list are
- * zero'd in xfreeblk().
- */
+/* Allocate new memory, initialized with zero. */
static void *
xgetblk(mbl_t **mbp, size_t s)
{
@@ -233,6 +226,16 @@ xgetblk(mbl_t **mbp, size_t s)
void *p;
size_t t = 0;
+ /*
+ * If the first block of the list has not enough free space,
+ * or there is no first block, get a new block. The new block
+ * is taken from the free list or, if there is no block on the
+ * free list, is allocated using xnewblk().
+ *
+ * If a new block is allocated it is initialized with zero.
+ * Blocks taken from the free list are zero'd in xfreeblk().
+ */
+
s = WORST_ALIGN(s);
if ((mb = *mbp) == NULL || mb->nfree < s) {
if ((mb = frmblks) == NULL || mb->size < s) {