]> granicus.if.org Git - procps-ng/commitdiff
top: do not lie about purported alphabetical orderings
authorJim Warner <james.warner@comcast.net>
Fri, 29 Nov 2013 06:00:00 +0000 (00:00 -0600)
committerJaromir Capik <jcapik@redhat.com>
Mon, 2 Dec 2013 20:37:36 +0000 (21:37 +0100)
Excluding those special X_XON/X_XOF enums, which might
not even be present, restore strict collating order of
all the case labels in the task_show switch statement.

Also, adjust a few sort callbacks for the same reason.

Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c

index 70eaa4a436685821ac1d9d6e8fbe8408c2e98ec5..59dcb3f15521297a1cc1d77a1cab6f46c07c4c7a 100644 (file)
--- a/top/top.c
+++ b/top/top.c
@@ -246,9 +246,9 @@ SCB_NUM1(CPU, pcpu)
 SCB_NUM1(DAT, drs)
 SCB_NUM1(DRT, dt)
 SCB_STRS(ENV, environ[0])
-SCB_NUM1(FLG, flags)
 SCB_NUM1(FL1, maj_flt)
 SCB_NUM1(FL2, min_flt)
+SCB_NUM1(FLG, flags)
 SCB_NUM1(FV1, maj_delta)
 SCB_NUM1(FV2, min_delta)
 SCB_NUMx(GID, egid)
@@ -5220,15 +5220,15 @@ static const char *task_show (const WIN_t *q, const proc_t *p) {
          case P_ENV:
             makeVAR(p->environ[0]);
             break;
-         case P_FLG:
-            cp = make_str(hex_make(p->flags, 1), W, Js, AUTOX_NO);
-            break;
          case P_FL1:
             cp = scale_num(p->maj_flt, W, Jn);
             break;
          case P_FL2:
             cp = scale_num(p->min_flt, W, Jn);
             break;
+         case P_FLG:
+            cp = make_str(hex_make(p->flags, 1), W, Js, AUTOX_NO);
+            break;
          case P_FV1:
             cp = scale_num(p->maj_delta, W, Jn);
             break;
@@ -5244,6 +5244,9 @@ static const char *task_show (const WIN_t *q, const proc_t *p) {
          case P_MEM:
             cp = scale_pcnt((float)pages2K(p->resident) * 100 / kb_main_total, W, Jn);
             break;
+         case P_NCE:
+            cp = make_num(p->nice, W, Jn, AUTOX_NO);
+            break;
          case P_NS1:   // IPCNS
          case P_NS2:   // MNTNS
          case P_NS3:   // NETNS
@@ -5255,9 +5258,6 @@ static const char *task_show (const WIN_t *q, const proc_t *p) {
             else cp = make_str("-", W, Js, i);
          }
             break;
-         case P_NCE:
-            cp = make_num(p->nice, W, Jn, AUTOX_NO);
-            break;
 #ifdef OOMEM_ENABLE
          case P_OOA:
             cp = make_num(p->oom_adj, W, Jn, AUTOX_NO);
@@ -5308,8 +5308,8 @@ static const char *task_show (const WIN_t *q, const proc_t *p) {
          case P_THD:
             cp = make_num(p->nlwp, W, Jn, AUTOX_NO);
             break;
-         case P_TME:
          case P_TM2:
+         case P_TME:
          {  TIC_t t = p->utime + p->stime;
             if (CHKw(q, Show_CTIMES)) t += (p->cutime + p->cstime);
             cp = scale_tics(t, W, Jn);