git: bc2ac2585aa8 - main - top(8): use designated initializers for sorted_state[]

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 21 Jun 2023 05:37:50 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=bc2ac2585aa89c110861972aeb243719ea5012b8

commit bc2ac2585aa89c110861972aeb243719ea5012b8
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-06-19 13:52:05 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-06-21 05:36:45 +0000

    top(8): use designated initializers for sorted_state[]
    
    Also correct comments for individual state, duplicating the S* constants
    descriptions from sys/proc.h [*].
    
    Reviewed by:    kevans (previous version)
    Noted by:       Mark Millard <marklmi@yahoo.com> [*]
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D40607
---
 usr.bin/top/machine.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c
index c11851ebce63..033861d3f7fb 100644
--- a/usr.bin/top/machine.c
+++ b/usr.bin/top/machine.c
@@ -1262,13 +1262,12 @@ compare_tid(const void *p1, const void *p2)
  */
 
 static const int sorted_state[] = {
-	0,	/* not used		*/
-	3,	/* sleep		*/
-	1,	/* ABANDONED (WAIT)	*/
-	6,	/* run			*/
-	5,	/* start		*/
-	2,	/* zombie		*/
-	4	/* stop			*/
+	[SIDL] =	3,	/* being created	*/
+	[SRUN] =	1,	/* running/runnable	*/
+	[SSLEEP] =	6,	/* sleeping		*/
+	[SSTOP] =	5,	/* stopped/suspended	*/
+	[SZOMB] =	2,	/* zombie		*/
+	[SWAIT] =	4,	/* intr			*/
 };