comparison src/undo.c @ 2232:2e6906bbc5f4 vim73

A few more fixes for undo file. Split test in two parts so that it doesn't fail with tiny features.
author Bram Moolenaar <bram@vim.org>
date Sun, 30 May 2010 13:26:21 +0200
parents aa6412cab544
children 43cad213cb7f
comparison
equal deleted inserted replaced
2231:aa6412cab544 2232:2e6906bbc5f4
856 *error = TRUE; 856 *error = TRUE;
857 return uep; 857 return uep;
858 } 858 }
859 vim_memset(array, 0, sizeof(char_u *) * uep->ue_size); 859 vim_memset(array, 0, sizeof(char_u *) * uep->ue_size);
860 } 860 }
861 else
862 array = NULL;
861 uep->ue_array = array; 863 uep->ue_array = array;
862 864
863 for (i = 0; i < uep->ue_size; ++i) 865 for (i = 0; i < uep->ue_size; ++i)
864 { 866 {
865 line_len = get4c(fp); 867 line_len = get4c(fp);
1363 while ((c = get2c(fp)) == UF_HEADER_MAGIC) 1365 while ((c = get2c(fp)) == UF_HEADER_MAGIC)
1364 { 1366 {
1365 if (num_read_uhps >= num_head) 1367 if (num_read_uhps >= num_head)
1366 { 1368 {
1367 corruption_error("num_head", file_name); 1369 corruption_error("num_head", file_name);
1368 u_free_uhp(uhp);
1369 goto error; 1370 goto error;
1370 } 1371 }
1371 1372
1372 uhp = (u_header_T *)U_ALLOC_LINE(sizeof(u_header_T)); 1373 uhp = (u_header_T *)U_ALLOC_LINE(sizeof(u_header_T));
1373 if (uhp == NULL) 1374 if (uhp == NULL)
1440 * num_head, and the uh_seq order is monotonic with respect to 1441 * num_head, and the uh_seq order is monotonic with respect to
1441 * creation time, the starting uh_seq can be > 0 if any undolevel 1442 * creation time, the starting uh_seq can be > 0 if any undolevel
1442 * culling was done at undofile write time, and there can be uh_seq 1443 * culling was done at undofile write time, and there can be uh_seq
1443 * gaps in the uhps. 1444 * gaps in the uhps.
1444 */ 1445 */
1445 for (i = num_read_uhps - 1; i >= -1; i--) 1446 for (i = num_read_uhps - 1; ; --i)
1446 { 1447 {
1447 /* if i == -1, we've hit the leftmost side of the table, so insert 1448 /* if i == -1, we've hit the leftmost side of the table, so insert
1448 * at uhp_table[0]. */ 1449 * at uhp_table[0]. */
1449 if (i == -1 || uhp->uh_seq > uhp_table[i]->uh_seq) 1450 if (i == -1 || uhp->uh_seq > uhp_table[i]->uh_seq)
1450 { 1451 {