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

Diff for /src/usr.bin/patch/pch.c between version 1.30 and 1.31

version 1.30, 2003/08/15 08:00:51 version 1.31, 2003/09/28 07:55:19
Line 138 
Line 138 
 static void  static void
 grow_hunkmax(void)  grow_hunkmax(void)
 {  {
         hunkmax *= 2;          int             new_hunkmax;
           char            **new_p_line;
           short           *new_p_len;
           char            *new_p_char;
   
           new_hunkmax = hunkmax * 2;
   
         if (p_line == NULL || p_len == NULL || p_char == NULL)          if (p_line == NULL || p_len == NULL || p_char == NULL)
                 fatal("Internal memory allocation error\n");                  fatal("Internal memory allocation error\n");
   
         p_line = realloc(p_line, hunkmax * sizeof(char *));          new_p_line = realloc(p_line, new_hunkmax * sizeof(char *));
         p_len = realloc(p_len, hunkmax * sizeof(short));          if (new_p_line == NULL)
         p_char = realloc(p_char, hunkmax * sizeof(char));                  free(p_line);
   
         if (p_line != NULL && p_len != NULL && p_char != NULL)          new_p_len = realloc(p_len, new_hunkmax * sizeof(short));
           if (new_p_len == NULL)
                   free(p_len);
   
           new_p_char = realloc(p_char, new_hunkmax * sizeof(char));
           if (new_p_char == NULL)
                   free(p_char);
   
           p_char = new_p_char;
           p_len = new_p_len;
           p_line = new_p_line;
   
           if (p_line != NULL && p_len != NULL && p_char != NULL) {
                   hunkmax = new_hunkmax;
                 return;                  return;
           }
   
         if (!using_plan_a)          if (!using_plan_a)
                 fatal("out of memory\n");                  fatal("out of memory\n");
         out_of_mem = true;      /* whatever is null will be allocated again */          out_of_mem = true;      /* whatever is null will be allocated again */

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31