]> granicus.if.org Git - procps-ng/commitdiff
topzFix2-3.0.3.patch
authoralbert <>
Sun, 13 Oct 2002 18:23:22 +0000 (18:23 +0000)
committeralbert <>
Sun, 13 Oct 2002 18:23:22 +0000 (18:23 +0000)
top.c

diff --git a/top.c b/top.c
index 7644d4a8f569e0d3d9139f5b343aae4375102e48..e2eb505eb63ee7a0d29f2ef9f5e714057dbfc73f 100644 (file)
--- a/top.c
+++ b/top.c
@@ -1756,7 +1756,7 @@ static void frame_states (proc_t **ppt, int show)
    // reuse memory each time around
    hist_tmp = hist_sav;
    hist_sav = hist_new;
-   hist_new = tmp;
+   hist_new = hist_tmp;
 
    total = running = sleeping = stopped = zombie = 0;
 
@@ -2412,18 +2412,20 @@ static void do_key (unsigned c)
 
       case '<':
          if (VIZCHKc) {
-            PFLG_t *p =
-               memchr(Curwin->procflags, Curwin->sortindx, Curwin->maxpflgs);
-            if (p && --p >= Curwin->procflags)
+            PFLG_t *p = Curwin->procflags + Curwin->maxpflgs - 1;
+            while (*p != Curwin->sortindx)
+               --p;
+            if (--p >= Curwin->procflags)
                Curwin->sortindx = *p;
          }
          break;
 
       case '>':
          if (VIZCHKc) {
-            PFLG_t *p =
-               memchr(Curwin->procflags, Curwin->sortindx, Curwin->maxpflgs);
-            if (p && ++p < Curwin->procflags + Curwin->maxpflgs)
+            PFLG_t *p = Curwin->procflags;
+            while (*p != Curwin->sortindx)
+               ++p;
+            if (++p < Curwin->procflags + Curwin->maxpflgs)
                Curwin->sortindx = *p;
          }
          break;