Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: reduce noise in storage_class_name



details:   https://anonhg.NetBSD.org/src/rev/5a535dc62bf2
branches:  trunk
changeset: 984381:5a535dc62bf2
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jul 05 19:55:51 2021 +0000

description:
lint: reduce noise in storage_class_name

No functional change.

diffstat:

 usr.bin/xlint/lint1/decl.c |  23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

diffs (47 lines):

diff -r d3905c371166 -r 5a535dc62bf2 usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Mon Jul 05 19:53:43 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Mon Jul 05 19:55:51 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.194 2021/07/05 19:48:32 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.195 2021/07/05 19:55:51 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.194 2021/07/05 19:48:32 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.195 2021/07/05 19:55:51 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1783,20 +1783,17 @@
 const char *
 storage_class_name(scl_t sc)
 {
-       const   char *s;
-
        switch (sc) {
-       case EXTERN:    s = "extern";   break;
-       case STATIC:    s = "static";   break;
-       case AUTO:      s = "auto";     break;
-       case REG:       s = "register"; break;
-       case TYPEDEF:   s = "typedef";  break;
-       case STRUCT_TAG:s = "struct";   break;
-       case UNION_TAG: s = "union";    break;
-       case ENUM_TAG:  s = "enum";     break;
+       case EXTERN:    return "extern";
+       case STATIC:    return "static";
+       case AUTO:      return "auto";
+       case REG:       return "register";
+       case TYPEDEF:   return "typedef";
+       case STRUCT_TAG:return "struct";
+       case UNION_TAG: return "union";
+       case ENUM_TAG:  return "enum";
        default:        lint_assert(/*CONSTCOND*/false);
        }
-       return s;
 }
 
 /*



Home | Main Index | Thread Index | Old Index