[BACK]Return to display.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Diff for /src/usr.bin/mg/display.c between version 1.41 and 1.42

version 1.41, 2013/05/31 18:03:44 version 1.42, 2014/10/16 17:36:11
Line 170 
Line 170 
                 (a) = tmp;                                      \                  (a) = tmp;                                      \
         } while (0)          } while (0)
   
   #define TRYREALLOCARRAY(a, n, m) do {                           \
                   void *tmp;                                      \
                   if ((tmp = reallocarray((a), (n), (m))) == NULL) {\
                           panic("out of memory in display code"); \
                   }                                               \
                   (a) = tmp;                                      \
           } while (0)
   
         /* No update needed */          /* No update needed */
         if (!first_run && !force && !rowchanged && !colchanged)          if (!first_run && !force && !rowchanged && !colchanged)
                 return (TRUE);                  return (TRUE);
Line 198 
Line 206 
                         }                          }
                 }                  }
   
                 TRYREALLOC(score, newrow * newrow * sizeof(struct score));                  TRYREALLOCARRAY(score, newrow * newrow, sizeof(struct score));
                 TRYREALLOC(vscreen, (newrow - 1) * sizeof(struct video *));                  TRYREALLOCARRAY(vscreen, (newrow - 1), sizeof(struct video *));
                 TRYREALLOC(pscreen, (newrow - 1) * sizeof(struct video *));                  TRYREALLOCARRAY(pscreen, (newrow - 1), sizeof(struct video *));
                 TRYREALLOC(video, (2 * (newrow - 1)) * sizeof(struct video));                  TRYREALLOCARRAY(video, (2 * (newrow - 1)), sizeof(struct video));
   
                 /*                  /*
                  * Zero-out the entries we just allocated.                   * Zero-out the entries we just allocated.
Line 222 
Line 230 
         }          }
         if (rowchanged || colchanged || first_run) {          if (rowchanged || colchanged || first_run) {
                 for (i = 0; i < 2 * (newrow - 1); i++)                  for (i = 0; i < 2 * (newrow - 1); i++)
                         TRYREALLOC(video[i].v_text, newcol * sizeof(char));                          TRYREALLOC(video[i].v_text, newcol);
                 TRYREALLOC(blanks.v_text, newcol * sizeof(char));                  TRYREALLOC(blanks.v_text, newcol);
         }          }
   
         nrow = newrow;          nrow = newrow;

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42