comparison src/diff.c @ 15840:734b1928a5aa v8.1.0927

patch 8.1.0927: USE_CR is never defined commit https://github.com/vim/vim/commit/00590740081489db69f43d9f1c0e3f70e29ce6da Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 15 21:06:09 2019 +0100 patch 8.1.0927: USE_CR is never defined Problem: USE_CR is never defined. Solution: Remove usage of USE_CR. (Ken Takata, closes https://github.com/vim/vim/issues/3958)
author Bram Moolenaar <Bram@vim.org>
date Fri, 15 Feb 2019 21:15:07 +0100
parents 1ec942f1b648
children 360c93a884d0
comparison
equal deleted inserted replaced
15839:ed6ecf44dbaf 15840:734b1928a5aa
87 static void diff_copy_entry(diff_T *dprev, diff_T *dp, int idx_orig, int idx_new); 87 static void diff_copy_entry(diff_T *dprev, diff_T *dp, int idx_orig, int idx_new);
88 static diff_T *diff_alloc_new(tabpage_T *tp, diff_T *dprev, diff_T *dp); 88 static diff_T *diff_alloc_new(tabpage_T *tp, diff_T *dprev, diff_T *dp);
89 static int parse_diff_ed(char_u *line, linenr_T *lnum_orig, long *count_orig, linenr_T *lnum_new, long *count_new); 89 static int parse_diff_ed(char_u *line, linenr_T *lnum_orig, long *count_orig, linenr_T *lnum_new, long *count_new);
90 static int parse_diff_unified(char_u *line, linenr_T *lnum_orig, long *count_orig, linenr_T *lnum_new, long *count_new); 90 static int parse_diff_unified(char_u *line, linenr_T *lnum_orig, long *count_orig, linenr_T *lnum_new, long *count_new);
91 static int xdiff_out(void *priv, mmbuffer_t *mb, int nbuf); 91 static int xdiff_out(void *priv, mmbuffer_t *mb, int nbuf);
92
93 #ifndef USE_CR
94 # define tag_fgets vim_fgets
95 #endif
96 92
97 /* 93 /*
98 * Called when deleting or unloading a buffer: No longer make a diff with it. 94 * Called when deleting or unloading a buffer: No longer make a diff with it.
99 */ 95 */
100 void 96 void
994 char_u linebuf[LBUFLEN]; 990 char_u linebuf[LBUFLEN];
995 991
996 for (;;) 992 for (;;)
997 { 993 {
998 /* There must be a line that contains "1c1". */ 994 /* There must be a line that contains "1c1". */
999 if (tag_fgets(linebuf, LBUFLEN, fd)) 995 if (vim_fgets(linebuf, LBUFLEN, fd))
1000 break; 996 break;
1001 if (STRNCMP(linebuf, "1c1", 3) == 0) 997 if (STRNCMP(linebuf, "1c1", 3) == 0)
1002 ok = TRUE; 998 ok = TRUE;
1003 } 999 }
1004 fclose(fd); 1000 fclose(fd);
1602 break; // did last line 1598 break; // did last line
1603 line = ((char_u **)dout->dout_ga.ga_data)[line_idx++]; 1599 line = ((char_u **)dout->dout_ga.ga_data)[line_idx++];
1604 } 1600 }
1605 else 1601 else
1606 { 1602 {
1607 if (tag_fgets(linebuf, LBUFLEN, fd)) 1603 if (vim_fgets(linebuf, LBUFLEN, fd))
1608 break; // end of file 1604 break; // end of file
1609 line = linebuf; 1605 line = linebuf;
1610 } 1606 }
1611 1607
1612 if (diffstyle == DIFF_NONE) 1608 if (diffstyle == DIFF_NONE)
1624 if (isdigit(*line)) 1620 if (isdigit(*line))
1625 diffstyle = DIFF_ED; 1621 diffstyle = DIFF_ED;
1626 else if ((STRNCMP(line, "@@ ", 3) == 0)) 1622 else if ((STRNCMP(line, "@@ ", 3) == 0))
1627 diffstyle = DIFF_UNIFIED; 1623 diffstyle = DIFF_UNIFIED;
1628 else if ((STRNCMP(line, "--- ", 4) == 0) 1624 else if ((STRNCMP(line, "--- ", 4) == 0)
1629 && (tag_fgets(linebuf, LBUFLEN, fd) == 0) 1625 && (vim_fgets(linebuf, LBUFLEN, fd) == 0)
1630 && (STRNCMP(line, "+++ ", 4) == 0) 1626 && (STRNCMP(line, "+++ ", 4) == 0)
1631 && (tag_fgets(linebuf, LBUFLEN, fd) == 0) 1627 && (vim_fgets(linebuf, LBUFLEN, fd) == 0)
1632 && (STRNCMP(line, "@@ ", 3) == 0)) 1628 && (STRNCMP(line, "@@ ", 3) == 0))
1633 diffstyle = DIFF_UNIFIED; 1629 diffstyle = DIFF_UNIFIED;
1634 else 1630 else
1635 // Format not recognized yet, skip over this line. Cygwin diff 1631 // Format not recognized yet, skip over this line. Cygwin diff
1636 // may put a warning at the start of the file. 1632 // may put a warning at the start of the file.