Module Name: src
Committed By: rillig
Date: Sat Aug 28 12:06:09 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: decl.c
Log Message:
lint: clean up alignment_in_bits
The given type can never be NULL, and an array can never have NULL as
subtype.
To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/usr.bin/xlint/lint1/decl.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/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.222 src/usr.bin/xlint/lint1/decl.c:1.223
--- src/usr.bin/xlint/lint1/decl.c:1.222 Mon Aug 16 06:49:56 2021
+++ src/usr.bin/xlint/lint1/decl.c Sat Aug 28 12:06:08 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.222 2021/08/16 06:49:56 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.223 2021/08/28 12:06:08 rillig Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.222 2021/08/16 06:49:56 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.223 2021/08/28 12:06:08 rillig Exp $");
#endif
#include <sys/param.h>
@@ -957,12 +957,9 @@ alignment_in_bits(const type_t *tp)
size_t a;
tspec_t t;
- while (tp != NULL && tp->t_tspec == ARRAY)
+ while (tp->t_tspec == ARRAY)
tp = tp->t_subt;
- if (tp == NULL)
- return -1;
-
if ((t = tp->t_tspec) == STRUCT || t == UNION) {
a = tp->t_str->sou_align_in_bits;
} else if (t == FUNC) {