From: krw Date: Wed, 9 Nov 2022 15:17:28 +0000 (+0000) Subject: Use nitems() instead of a terminating { NULL, NULL } entry. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6a3bf7043f0edbf6d44c7fde8734daf51b969401;p=openbsd Use nitems() instead of a terminating { NULL, NULL } entry. --- diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index 353ea6076c7..8f991ddc487 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -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 @@ -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;