Use nitems() instead of a terminating { NULL, NULL } entry.
authorkrw <krw@openbsd.org>
Wed, 9 Nov 2022 15:17:28 +0000 (15:17 +0000)
committerkrw <krw@openbsd.org>
Wed, 9 Nov 2022 15:17:28 +0000 (15:17 +0000)
sbin/disklabel/editor.c

index 353ea60..8f991dd 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: editor.c,v 1.377 2022/11/08 17:52:11 krw Exp $        */
+/*     $OpenBSD: editor.c,v 1.378 2022/11/09 15:17:28 krw Exp $        */
 
 /*
  * Copyright (c) 1997-2000 Todd C. Miller <millert@openbsd.org>
@@ -1378,7 +1378,6 @@ getdisktype(struct disklabel *lp, char *banner, char *dev)
                { "hd",   "HP-IB" },
                { "vnd",  "VND" },
                { "svnd", "VND" },
-               { NULL,   NULL }
        };
 
        if ((s = basename(dev)) != NULL) {
@@ -1387,7 +1386,7 @@ getdisktype(struct disklabel *lp, char *banner, char *dev)
                i = strcspn(s, "0123456789");
                s[i] = '\0';
                dev = s;
-               for (i = 0; dtypes[i].dev != NULL; i++) {
+               for (i = 0; i < nitems(dtypes); i++) {
                        if (strcmp(dev, dtypes[i].dev) == 0) {
                                def = dtypes[i].type;
                                break;