To: vim_dev@googlegroups.com Subject: Patch 8.1.2389 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2389 Problem: Using old C style comments. Solution: Use // comments where appropriate. Files: src/libvterm/src/screen.c, src/libvterm/src/unicode.c, src/libvterm/src/vterm.c, src/libvterm/t/harness.c, src/libvterm/include/vterm.h, src/xdiff/xdiffi.c, src/xdiff/xemit.c, src/xdiff/xhistogram.c, src/xdiff/xpatience.c, src/xdiff/xutils.c, src/xdiff/xdiff.h, src/xdiff/xdiffi.h, src/xdiff/xemit.h, src/xdiff/xinclude.h, src/xdiff/xmacros.h, src/xdiff/xprepare.h, src/xdiff/xtypes.h, src/xdiff/xutils.h *** ../vim-8.1.2388/src/libvterm/src/screen.c 2019-10-10 13:22:36.959636194 +0200 --- src/libvterm/src/screen.c 2019-12-04 22:07:58.038027668 +0100 *************** *** 773,779 **** cell->bg = intcell->pen.bg; if(vterm_get_special_pty_type() == 2) { ! /* Get correct cell width from cell information contained in line buffer */ if(pos.col < (screen->cols - 1) && getcell(screen, pos.row, pos.col + 1)->chars[0] == (uint32_t)-1) { if(getcell(screen, pos.row, pos.col)->chars[0] == 0x20) { --- 773,779 ---- cell->bg = intcell->pen.bg; if(vterm_get_special_pty_type() == 2) { ! // Get correct cell width from cell information contained in line buffer if(pos.col < (screen->cols - 1) && getcell(screen, pos.row, pos.col + 1)->chars[0] == (uint32_t)-1) { if(getcell(screen, pos.row, pos.col)->chars[0] == 0x20) { *************** *** 798,805 **** return 1; } ! // Copy external to internal representation of a screen cell ! /* static because it's only used internally for sb_popline during resize */ static int vterm_screen_set_cell(VTermScreen *screen, VTermPos pos, const VTermScreenCell *cell) { ScreenCell *intcell = getcell(screen, pos.row, pos.col); --- 798,807 ---- return 1; } ! /* ! * Copy external to internal representation of a screen cell ! * static because it's only used internally for sb_popline during resize ! */ static int vterm_screen_set_cell(VTermScreen *screen, VTermPos pos, const VTermScreenCell *cell) { ScreenCell *intcell = getcell(screen, pos.row, pos.col); *** ../vim-8.1.2388/src/libvterm/src/unicode.c 2019-09-13 22:30:07.588524105 +0200 --- src/libvterm/src/unicode.c 2019-12-04 22:08:30.525908451 +0100 *************** *** 452,458 **** } #endif ! #if 0 /* unused */ static int mk_wcswidth(const uint32_t *pwcs, size_t n) { int w, width = 0; --- 452,458 ---- } #endif ! #if 0 // unused static int mk_wcswidth(const uint32_t *pwcs, size_t n) { int w, width = 0; *************** *** 479,486 **** static int mk_wcwidth_cjk(uint32_t ucs) { #endif ! /* sorted list of non-overlapping intervals of East Asian Ambiguous ! * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ static const struct interval ambiguous[] = { { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, --- 479,486 ---- static int mk_wcwidth_cjk(uint32_t ucs) { #endif ! // sorted list of non-overlapping intervals of East Asian Ambiguous ! // characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" static const struct interval ambiguous[] = { { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, *** ../vim-8.1.2388/src/libvterm/src/vterm.c 2019-08-18 20:41:10.692526067 +0200 --- src/libvterm/src/vterm.c 2019-12-04 22:08:47.917844785 +0100 *************** *** 10,18 **** #include "utf8.h" ! /***************** ! * API functions * ! *****************/ static void *default_malloc(size_t size, void *allocdata UNUSED) { --- 10,18 ---- #include "utf8.h" ! /////////////////// ! // API functions // ! /////////////////// static void *default_malloc(size_t size, void *allocdata UNUSED) { *** ../vim-8.1.2388/src/libvterm/t/harness.c 2018-03-25 15:36:08.000000000 +0200 --- src/libvterm/t/harness.c 2019-12-04 22:09:31.617685277 +0100 *************** *** 1,5 **** #include "vterm.h" ! #include "../src/vterm_internal.h" /* We pull in some internal bits too */ #include #include --- 1,5 ---- #include "vterm.h" ! #include "../src/vterm_internal.h" // We pull in some internal bits too #include #include *************** *** 163,178 **** } static VTermParserCallbacks parser_cbs = { ! parser_text, /* text */ ! parser_control, /* control */ ! parser_escape, /* escape */ ! parser_csi, /* csi */ ! parser_osc, /* osc */ ! parser_dcs, /* dcs */ ! NULL /* resize */ }; ! /* These callbacks are shared by State and Screen */ static int want_movecursor = 0; static VTermPos state_pos; --- 163,178 ---- } static VTermParserCallbacks parser_cbs = { ! parser_text, // text ! parser_control, // control ! parser_escape, // escape ! parser_csi, // csi ! parser_osc, // osc ! parser_dcs, // dcs ! NULL // resize }; ! // These callbacks are shared by State and Screen static int want_movecursor = 0; static VTermPos state_pos; *************** *** 241,247 **** return 0; } ! /* These callbacks are for State */ static int want_state_putglyph = 0; static int state_putglyph(VTermGlyphInfo *info, VTermPos pos, void *user) --- 241,247 ---- return 0; } ! // These callbacks are for State static int want_state_putglyph = 0; static int state_putglyph(VTermGlyphInfo *info, VTermPos pos, void *user) *************** *** 333,349 **** } VTermStateCallbacks state_cbs = { ! state_putglyph, /* putglyph */ ! movecursor, /* movecursor */ ! scrollrect, /* scrollrect */ ! moverect, /* moverect */ ! state_erase, /* erase */ ! NULL, /* initpen */ ! state_setpenattr, /* setpenattr */ ! settermprop, /* settermprop */ ! NULL, /* bell */ ! NULL, /* resize */ ! state_setlineinfo, /* setlineinfo */ }; static int want_screen_damage = 0; --- 333,349 ---- } VTermStateCallbacks state_cbs = { ! state_putglyph, // putglyph ! movecursor, // movecursor ! scrollrect, // scrollrect ! moverect, // moverect ! state_erase, // erase ! NULL, // initpen ! state_setpenattr, // setpenattr ! settermprop, // settermprop ! NULL, // bell ! NULL, // resize ! state_setlineinfo, // setlineinfo }; static int want_screen_damage = 0; *************** *** 427,433 **** if(!want_screen_scrollback) return 0; ! /* All lines of scrollback contain "ABCDE" */ for(col = 0; col < cols; col++) { if(col < 5) cells[col].chars[0] = 'A' + col; --- 427,433 ---- if(!want_screen_scrollback) return 0; ! // All lines of scrollback contain "ABCDE" for(col = 0; col < cols; col++) { if(col < 5) cells[col].chars[0] = 'A' + col; *************** *** 442,455 **** } VTermScreenCallbacks screen_cbs = { ! screen_damage, /* damage */ ! moverect, /* moverect */ ! movecursor, /* movecursor */ ! settermprop, /* settermprop */ ! NULL, /* bell */ ! NULL, /* resize */ ! screen_sb_pushline, /* sb_pushline */ ! screen_sb_popline /* sb_popline */ }; int main(int argc, char **argv) --- 442,455 ---- } VTermScreenCallbacks screen_cbs = { ! screen_damage, // damage ! moverect, // moverect ! movecursor, // movecursor ! settermprop, // settermprop ! NULL, // bell ! NULL, // resize ! screen_sb_pushline, // sb_pushline ! screen_sb_popline // sb_popline }; int main(int argc, char **argv) *************** *** 592,600 **** } else if(streq(line, "WANTENCODING")) { ! /* This isn't really external API but it's hard to get this out any ! * other way ! */ encoding.enc = vterm_lookup_encoding(ENC_UTF8, 'u'); if(encoding.enc->init) (*encoding.enc->init)(encoding.enc, encoding.data); --- 592,599 ---- } else if(streq(line, "WANTENCODING")) { ! // This isn't really external API but it's hard to get this out any ! // other way encoding.enc = vterm_lookup_encoding(ENC_UTF8, 'u'); if(encoding.enc->init) (*encoding.enc->init)(encoding.enc, encoding.data); *************** *** 833,839 **** else if(len == 0) printf("\n"); else { ! /* Put an overwrite guard at both ends of the buffer */ unsigned char *buffer = malloc(len + 4); unsigned char *text = buffer + 2; text[-2] = 0x55; text[-1] = 0xAA; --- 832,838 ---- else if(len == 0) printf("\n"); else { ! // Put an overwrite guard at both ends of the buffer unsigned char *buffer = malloc(len + 4); unsigned char *text = buffer + 2; text[-2] = 0x55; text[-1] = 0xAA; *** ../vim-8.1.2388/src/libvterm/include/vterm.h 2019-10-10 21:13:59.962360351 +0200 --- src/libvterm/include/vterm.h 2019-12-04 22:09:41.373649746 +0100 *************** *** 216,229 **** // Parser layer // ------------ ! /* Flag to indicate non-final subparameters in a single CSI parameter. ! * Consider ! * CSI 1;2:3:4;5a ! * 1 4 and 5 are final. ! * 2 and 3 are non-final and will have this bit set ! * ! * Don't confuse this with the final byte of the CSI escape; 'a' in this case. ! */ #define CSI_ARG_FLAG_MORE (1U<<31) #define CSI_ARG_MASK (~(1U<<31)) --- 216,228 ---- // Parser layer // ------------ ! // Flag to indicate non-final subparameters in a single CSI parameter. ! // Consider ! // CSI 1;2:3:4;5a ! // 1 4 and 5 are final. ! // 2 and 3 are non-final and will have this bit set ! // ! // Don't confuse this with the final byte of the CSI escape; 'a' in this case. #define CSI_ARG_FLAG_MORE (1U<<31) #define CSI_ARG_MASK (~(1U<<31)) *************** *** 357,363 **** void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user); void *vterm_screen_get_cbdata(VTermScreen *screen); ! /* Only invokes control, csi, osc, dcs */ void vterm_screen_set_unrecognised_fallbacks(VTermScreen *screen, const VTermParserCallbacks *fallbacks, void *user); void *vterm_screen_get_unrecognised_fbdata(VTermScreen *screen); --- 356,362 ---- void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user); void *vterm_screen_get_cbdata(VTermScreen *screen); ! // Only invokes control, csi, osc, dcs void vterm_screen_set_unrecognised_fallbacks(VTermScreen *screen, const VTermParserCallbacks *fallbacks, void *user); void *vterm_screen_get_unrecognised_fbdata(VTermScreen *screen); *** ../vim-8.1.2388/src/xdiff/xdiffi.c 2018-09-13 15:33:39.601712271 +0200 --- src/xdiff/xdiffi.c 2019-12-04 22:10:52.089392993 +0100 *************** *** 418,441 **** ret += 1; else if (c == '\t') ret += 8 - ret % 8; ! /* ignore other whitespace characters */ if (ret >= MAX_INDENT) return MAX_INDENT; } ! /* The line contains only whitespace. */ return -1; } /* ! * If more than this number of consecutive blank rows are found, just return this ! * value. This avoids requiring O(N^2) work for pathological cases, and also ! * ensures that the output of score_split fits in an int. */ #define MAX_BLANKS 20 ! /* Characteristics measured about a hypothetical split position. */ struct split_measurement { /* * Is the split at the end of the file (aside from any blank lines)? --- 418,441 ---- ret += 1; else if (c == '\t') ret += 8 - ret % 8; ! // ignore other whitespace characters if (ret >= MAX_INDENT) return MAX_INDENT; } ! // The line contains only whitespace. return -1; } /* ! * If more than this number of consecutive blank rows are found, just return ! * this value. This avoids requiring O(N^2) work for pathological cases, and ! * also ensures that the output of score_split fits in an int. */ #define MAX_BLANKS 20 ! // Characteristics measured about a hypothetical split position. struct split_measurement { /* * Is the split at the end of the file (aside from any blank lines)? *************** *** 472,481 **** }; struct split_score { ! /* The effective indent of this split (smaller is preferred). */ int effective_indent; ! /* Penalty for this split (smaller is preferred). */ int penalty; }; --- 472,481 ---- }; struct split_score { ! // The effective indent of this split (smaller is preferred). int effective_indent; ! // Penalty for this split (smaller is preferred). int penalty; }; *************** *** 534,549 **** * integer math. */ ! /* Penalty if there are no non-blank lines before the split */ #define START_OF_FILE_PENALTY 1 ! /* Penalty if there are no non-blank lines after the split */ #define END_OF_FILE_PENALTY 21 ! /* Multiplier for the number of blank lines around the split */ #define TOTAL_BLANK_WEIGHT (-30) ! /* Multiplier for the number of blank lines after the split */ #define POST_BLANK_WEIGHT 6 /* --- 534,549 ---- * integer math. */ ! // Penalty if there are no non-blank lines before the split #define START_OF_FILE_PENALTY 1 ! // Penalty if there are no non-blank lines after the split #define END_OF_FILE_PENALTY 21 ! // Multiplier for the number of blank lines around the split #define TOTAL_BLANK_WEIGHT (-30) ! // Multiplier for the number of blank lines after the split #define POST_BLANK_WEIGHT 6 /* *************** *** 610,616 **** post_blank = (m->indent == -1) ? 1 + m->post_blank : 0; total_blank = m->pre_blank + post_blank; ! /* Penalties based on nearby blank lines: */ s->penalty += TOTAL_BLANK_WEIGHT * total_blank; s->penalty += POST_BLANK_WEIGHT * post_blank; --- 610,616 ---- post_blank = (m->indent == -1) ? 1 + m->post_blank : 0; total_blank = m->pre_blank + post_blank; ! // Penalties based on nearby blank lines: s->penalty += TOTAL_BLANK_WEIGHT * total_blank; s->penalty += POST_BLANK_WEIGHT * post_blank; *************** *** 621,633 **** any_blanks = (total_blank != 0); ! /* Note that the effective indent is -1 at the end of the file: */ s->effective_indent += indent; if (indent == -1) { ! /* No additional adjustments needed. */ } else if (m->pre_indent == -1) { ! /* No additional adjustments needed. */ } else if (indent > m->pre_indent) { /* * The line is indented more than its predecessor. --- 621,633 ---- any_blanks = (total_blank != 0); ! // Note that the effective indent is -1 at the end of the file: s->effective_indent += indent; if (indent == -1) { ! // No additional adjustments needed. } else if (m->pre_indent == -1) { ! // No additional adjustments needed. } else if (indent > m->pre_indent) { /* * The line is indented more than its predecessor. *************** *** 669,675 **** static int score_cmp(struct split_score *s1, struct split_score *s2) { ! /* -1 if s1.effective_indent < s2->effective_indent, etc. */ int cmp_indents = ((s1->effective_indent > s2->effective_indent) - (s1->effective_indent < s2->effective_indent)); --- 669,675 ---- static int score_cmp(struct split_score *s1, struct split_score *s2) { ! // -1 if s1.effective_indent < s2->effective_indent, etc. int cmp_indents = ((s1->effective_indent > s2->effective_indent) - (s1->effective_indent < s2->effective_indent)); *************** *** 809,815 **** group_init(xdfo, &go); while (1) { ! /* If the group is empty in the to-be-compacted file, skip it: */ if (g.end == g.start) goto next; --- 809,815 ---- group_init(xdfo, &go); while (1) { ! // If the group is empty in the to-be-compacted file, skip it: if (g.end == g.start) goto next; *************** *** 828,834 **** */ end_matching_other = -1; ! /* Shift the group backward as much as possible: */ while (!group_slide_up(xdf, &g, flags)) if (group_previous(xdfo, &go)) xdl_bug("group sync broken sliding up"); --- 828,834 ---- */ end_matching_other = -1; ! // Shift the group backward as much as possible: while (!group_slide_up(xdf, &g, flags)) if (group_previous(xdfo, &go)) xdl_bug("group sync broken sliding up"); *************** *** 842,848 **** if (go.end > go.start) end_matching_other = g.end; ! /* Now shift the group forward as far as possible: */ while (1) { if (group_slide_down(xdf, &g, flags)) break; --- 842,848 ---- if (go.end > go.start) end_matching_other = g.end; ! // Now shift the group forward as far as possible: while (1) { if (group_slide_down(xdf, &g, flags)) break; *************** *** 863,869 **** */ if (g.end == earliest_end) { ! /* no shifting was possible */ } else if (end_matching_other != -1) { /* * Move the possibly merged group of changes back to line --- 863,869 ---- */ if (g.end == earliest_end) { ! // no shifting was possible } else if (end_matching_other != -1) { /* * Move the possibly merged group of changes back to line *************** *** 921,927 **** } next: ! /* Move past the just-processed group: */ if (group_next(xdf, &g)) break; if (group_next(xdfo, &go)) --- 921,927 ---- } next: ! // Move past the just-processed group: if (group_next(xdf, &g)) break; if (group_next(xdfo, &go)) *** ../vim-8.1.2388/src/xdiff/xemit.c 2018-09-25 18:59:16.903072148 +0200 --- src/xdiff/xemit.c 2019-12-04 22:11:15.677307663 +0100 *************** *** 54,62 **** xdchange_t *xch, *xchp, *lxch; long max_common = 2 * xecfg->ctxlen + xecfg->interhunkctxlen; long max_ignorable = xecfg->ctxlen; ! unsigned long ignored = 0; /* number of ignored blank lines */ ! /* remove ignorable changes that are too far before other changes */ for (xchp = *xscr; xchp && xchp->ignore; xchp = xchp->next) { xch = xchp->next; --- 54,62 ---- xdchange_t *xch, *xchp, *lxch; long max_common = 2 * xecfg->ctxlen + xecfg->interhunkctxlen; long max_ignorable = xecfg->ctxlen; ! unsigned long ignored = 0; // number of ignored blank lines ! // remove ignorable changes that are too far before other changes for (xchp = *xscr; xchp && xchp->ignore; xchp = xchp->next) { xch = xchp->next; *************** *** 99,107 **** static long def_ff(const char *rec, long len, char *buf, long sz, void *priv UNUSED) { if (len > 0 && ! (isalpha((unsigned char)*rec) || /* identifier? */ ! *rec == '_' || /* also identifier? */ ! *rec == '$')) { /* identifiers from VMS and other esoterico */ if (len > sz) len = sz; while (0 < len && isspace((unsigned char)rec[len - 1])) --- 99,107 ---- static long def_ff(const char *rec, long len, char *buf, long sz, void *priv UNUSED) { if (len > 0 && ! (isalpha((unsigned char)*rec) || // identifier? ! *rec == '_' || // also identifier? ! *rec == '$')) { // identifiers from VMS and other esoterico if (len > sz) len = sz; while (0 < len && isspace((unsigned char)rec[len - 1])) *************** *** 197,203 **** if (xecfg->flags & XDL_EMIT_FUNCCONTEXT) { long fs1, i1 = xch->i1; ! /* Appended chunk? */ if (i1 >= xe->xdf1.nrec) { long i2 = xch->i2; --- 197,203 ---- if (xecfg->flags & XDL_EMIT_FUNCCONTEXT) { long fs1, i1 = xch->i1; ! // Appended chunk? if (i1 >= xe->xdf1.nrec) { long i2 = xch->i2; *** ../vim-8.1.2388/src/xdiff/xhistogram.c 2018-09-10 17:50:32.713306941 +0200 --- src/xdiff/xhistogram.c 2019-12-04 22:11:36.029234135 +0100 *************** *** 55,62 **** struct record { unsigned int ptr, cnt; struct record *next; ! } **records, /* an occurrence */ ! **line_map; /* map of line to record chain */ chastore_t rcha; unsigned int *next_ptrs; unsigned int table_bits, --- 55,62 ---- struct record { unsigned int ptr, cnt; struct record *next; ! } **records, // an occurrence ! **line_map; // map of line to record chain chastore_t rcha; unsigned int *next_ptrs; unsigned int table_bits, *************** *** 128,134 **** */ NEXT_PTR(index, ptr) = rec->ptr; rec->ptr = ptr; ! /* cap rec->cnt at MAX_CNT */ rec->cnt = XDL_MIN(MAX_CNT, rec->cnt + 1); LINE_MAP(index, ptr) = rec; goto continue_scan; --- 128,134 ---- */ NEXT_PTR(index, ptr) = rec->ptr; rec->ptr = ptr; ! // cap rec->cnt at MAX_CNT rec->cnt = XDL_MIN(MAX_CNT, rec->cnt + 1); LINE_MAP(index, ptr) = rec; goto continue_scan; *************** *** 154,160 **** LINE_MAP(index, ptr) = rec; continue_scan: ! ; /* no op */ } return 0; --- 154,160 ---- LINE_MAP(index, ptr) = rec; continue_scan: ! ; // no op } return 0; *************** *** 266,272 **** index.records = NULL; index.line_map = NULL; ! /* in case of early xdl_cha_free() */ index.rcha.head = NULL; index.table_bits = xdl_hashbits(count1); --- 266,272 ---- index.records = NULL; index.line_map = NULL; ! // in case of early xdl_cha_free() index.rcha.head = NULL; index.table_bits = xdl_hashbits(count1); *************** *** 288,294 **** goto cleanup; memset(index.next_ptrs, 0, sz); ! /* lines / 4 + 1 comes from xprepare.c:xdl_prepare_ctx() */ if (xdl_cha_init(&index.rcha, sizeof(struct record), count1 / 4 + 1) < 0) goto cleanup; --- 288,294 ---- goto cleanup; memset(index.next_ptrs, 0, sz); ! // lines / 4 + 1 comes from xprepare.c:xdl_prepare_ctx() if (xdl_cha_init(&index.rcha, sizeof(struct record), count1 / 4 + 1) < 0) goto cleanup; *** ../vim-8.1.2388/src/xdiff/xpatience.c 2018-09-13 17:32:03.152465980 +0200 --- src/xdiff/xpatience.c 2019-12-04 22:11:56.565160035 +0100 *************** *** 69,75 **** */ unsigned anchor : 1; } *entries, *first, *last; ! /* were common records found? */ unsigned long has_matches; mmfile_t *file1, *file2; xdfenv_t *env; --- 69,75 ---- */ unsigned anchor : 1; } *entries, *first, *last; ! // were common records found? unsigned long has_matches; mmfile_t *file1, *file2; xdfenv_t *env; *************** *** 86,92 **** return 0; } ! /* The argument "pass" is 1 for the first file, 2 for the second. */ static void insert_record(xpparam_t const *xpp, int line, struct hashmap *map, int pass) { --- 86,92 ---- return 0; } ! // The argument "pass" is 1 for the first file, 2 for the second. static void insert_record(xpparam_t const *xpp, int line, struct hashmap *map, int pass) { *************** *** 155,161 **** result->xpp = xpp; result->env = env; ! /* We know exactly how large we want the hash map */ result->alloc = count1 * 2; result->entries = (struct entry *) xdl_malloc(result->alloc * sizeof(struct entry)); --- 155,161 ---- result->xpp = xpp; result->env = env; ! // We know exactly how large we want the hash map result->alloc = count1 * 2; result->entries = (struct entry *) xdl_malloc(result->alloc * sizeof(struct entry)); *************** *** 163,173 **** return -1; memset(result->entries, 0, result->alloc * sizeof(struct entry)); ! /* First, fill with entries from the first file */ while (count1--) insert_record(xpp, line1++, result, 1); ! /* Then search for matches in the second file */ while (count2--) insert_record(xpp, line2++, result, 2); --- 163,173 ---- return -1; memset(result->entries, 0, result->alloc * sizeof(struct entry)); ! // First, fill with entries from the first file while (count1--) insert_record(xpp, line1++, result, 1); ! // Then search for matches in the second file while (count2--) insert_record(xpp, line2++, result, 2); *************** *** 185,197 **** while (left + 1 < right) { int middle = left + (right - left) / 2; ! /* by construction, no two entries can be equal */ if (sequence[middle]->line2 > entry->line2) right = middle; else left = middle; } ! /* return the index in "sequence", _not_ the sequence length */ return left; } --- 185,197 ---- while (left + 1 < right) { int middle = left + (right - left) / 2; ! // by construction, no two entries can be equal if (sequence[middle]->line2 > entry->line2) right = middle; else left = middle; } ! // return the index in "sequence", _not_ the sequence length return left; } *************** *** 216,222 **** */ int anchor_i = -1; ! /* Added to silence Coverity. */ if (sequence == NULL) return map->first; --- 216,222 ---- */ int anchor_i = -1; ! // Added to silence Coverity. if (sequence == NULL) return map->first; *************** *** 237,249 **** } } ! /* No common unique lines were found */ if (!longest) { xdl_free(sequence); return NULL; } ! /* Iterate starting at the last element, adjusting the "next" members */ entry = sequence[longest - 1]; entry->next = NULL; while (entry->previous) { --- 237,249 ---- } } ! // No common unique lines were found if (!longest) { xdl_free(sequence); return NULL; } ! // Iterate starting at the last element, adjusting the "next" members entry = sequence[longest - 1]; entry->next = NULL; while (entry->previous) { *************** *** 273,279 **** int next1, next2; for (;;) { ! /* Try to grow the line ranges of common lines */ if (first) { next1 = first->line1; next2 = first->line2; --- 273,279 ---- int next1, next2; for (;;) { ! // Try to grow the line ranges of common lines if (first) { next1 = first->line1; next2 = first->line2; *************** *** 292,298 **** line2++; } ! /* Recurse */ if (next1 > line1 || next2 > line2) { struct hashmap submap; --- 292,298 ---- line2++; } ! // Recurse if (next1 > line1 || next2 > line2) { struct hashmap submap; *************** *** 343,349 **** struct entry *first; int result = 0; ! /* trivial case: one side is empty */ if (!count1) { while(count2--) env->xdf2.rchg[line2++ - 1] = 1; --- 343,349 ---- struct entry *first; int result = 0; ! // trivial case: one side is empty if (!count1) { while(count2--) env->xdf2.rchg[line2++ - 1] = 1; *************** *** 359,365 **** line1, count1, line2, count2)) return -1; ! /* are there any matching lines at all? */ if (!map.has_matches) { while(count1--) env->xdf1.rchg[line1++ - 1] = 1; --- 359,365 ---- line1, count1, line2, count2)) return -1; ! // are there any matching lines at all? if (!map.has_matches) { while(count1--) env->xdf1.rchg[line1++ - 1] = 1; *************** *** 387,393 **** if (xdl_prepare_env(file1, file2, xpp, env) < 0) return -1; ! /* environment is cleaned up in xdl_diff() */ return patience_diff(file1, file2, xpp, env, 1, env->xdf1.nrec, 1, env->xdf2.nrec); } --- 387,393 ---- if (xdl_prepare_env(file1, file2, xpp, env) < 0) return -1; ! // environment is cleaned up in xdl_diff() return patience_diff(file1, file2, xpp, env, 1, env->xdf1.nrec, 1, env->xdf2.nrec); } *** ../vim-8.1.2388/src/xdiff/xutils.c 2018-09-16 15:14:15.078419097 +0200 --- src/xdiff/xutils.c 2019-12-04 22:12:23.513062945 +0100 *************** *** 168,174 **** s--; if (s == i) return 1; ! /* do not ignore CR at the end of an incomplete line */ if (complete && s == i + 1 && l[i] == '\r') return 1; return 0; --- 168,174 ---- s--; if (s == i) return 1; ! // do not ignore CR at the end of an incomplete line if (complete && s == i + 1 && l[i] == '\r') return 1; return 0; *************** *** 208,214 **** } else if (flags & XDF_IGNORE_WHITESPACE_CHANGE) { while (i1 < s1 && i2 < s2) { if (XDL_ISSPACE(l1[i1]) && XDL_ISSPACE(l2[i2])) { ! /* Skip matching spaces and try again */ while (i1 < s1 && XDL_ISSPACE(l1[i1])) i1++; while (i2 < s2 && XDL_ISSPACE(l2[i2])) --- 208,214 ---- } else if (flags & XDF_IGNORE_WHITESPACE_CHANGE) { while (i1 < s1 && i2 < s2) { if (XDL_ISSPACE(l1[i1]) && XDL_ISSPACE(l2[i2])) { ! // Skip matching spaces and try again while (i1 < s1 && XDL_ISSPACE(l1[i1])) i1++; while (i2 < s2 && XDL_ISSPACE(l2[i2])) *************** *** 224,230 **** i2++; } } else if (flags & XDF_IGNORE_CR_AT_EOL) { ! /* Find the first difference and see how the line ends */ while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) { i1++; i2++; --- 224,230 ---- i2++; } } else if (flags & XDF_IGNORE_CR_AT_EOL) { ! // Find the first difference and see how the line ends while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) { i1++; i2++; *************** *** 261,267 **** for (; ptr < top && *ptr != '\n'; ptr++) { if (cr_at_eol_only) { ! /* do not ignore CR at the end of an incomplete line */ if (*ptr == '\r' && (ptr + 1 < top && ptr[1] == '\n')) continue; --- 261,267 ---- for (; ptr < top && *ptr != '\n'; ptr++) { if (cr_at_eol_only) { ! // do not ignore CR at the end of an incomplete line if (*ptr == '\r' && (ptr + 1 < top && ptr[1] == '\n')) continue; *************** *** 274,280 **** ptr++; at_eol = (top <= ptr + 1 || ptr[1] == '\n'); if (flags & XDF_IGNORE_WHITESPACE) ! ; /* already handled */ else if (flags & XDF_IGNORE_WHITESPACE_CHANGE && !at_eol) { ha += (ha << 5); --- 274,280 ---- ptr++; at_eol = (top <= ptr + 1 || ptr[1] == '\n'); if (flags & XDF_IGNORE_WHITESPACE) ! ; // already handled else if (flags & XDF_IGNORE_WHITESPACE_CHANGE && !at_eol) { ha += (ha << 5); *** ../vim-8.1.2388/src/xdiff/xdiff.h 2019-01-17 17:13:25.924984061 +0100 --- src/xdiff/xdiff.h 2019-12-04 22:12:40.765000875 +0100 *************** *** 25,33 **** #ifdef __cplusplus extern "C" { ! #endif /* #ifdef __cplusplus */ ! /* xpparm_t.flags */ #define XDF_NEED_MINIMAL (1 << 0) #define XDF_IGNORE_WHITESPACE (1 << 1) --- 25,33 ---- #ifdef __cplusplus extern "C" { ! #endif // #ifdef __cplusplus ! // xpparm_t.flags #define XDF_NEED_MINIMAL (1 << 0) #define XDF_IGNORE_WHITESPACE (1 << 1) *************** *** 48,69 **** #define XDF_INDENT_HEURISTIC (1 << 23) ! /* xdemitconf_t.flags */ #define XDL_EMIT_FUNCNAMES (1 << 0) #define XDL_EMIT_FUNCCONTEXT (1 << 2) ! /* merge simplification levels */ #define XDL_MERGE_MINIMAL 0 #define XDL_MERGE_EAGER 1 #define XDL_MERGE_ZEALOUS 2 #define XDL_MERGE_ZEALOUS_ALNUM 3 ! /* merge favor modes */ #define XDL_MERGE_FAVOR_OURS 1 #define XDL_MERGE_FAVOR_THEIRS 2 #define XDL_MERGE_FAVOR_UNION 3 ! /* merge output styles */ #define XDL_MERGE_DIFF3 1 typedef struct s_mmfile { --- 48,69 ---- #define XDF_INDENT_HEURISTIC (1 << 23) ! // xdemitconf_t.flags #define XDL_EMIT_FUNCNAMES (1 << 0) #define XDL_EMIT_FUNCCONTEXT (1 << 2) ! // merge simplification levels #define XDL_MERGE_MINIMAL 0 #define XDL_MERGE_EAGER 1 #define XDL_MERGE_ZEALOUS 2 #define XDL_MERGE_ZEALOUS_ALNUM 3 ! // merge favor modes #define XDL_MERGE_FAVOR_OURS 1 #define XDL_MERGE_FAVOR_THEIRS 2 #define XDL_MERGE_FAVOR_UNION 3 ! // merge output styles #define XDL_MERGE_DIFF3 1 typedef struct s_mmfile { *************** *** 79,85 **** typedef struct s_xpparam { unsigned long flags; ! /* See Documentation/diff-options.txt. */ char **anchors; size_t anchors_nr; } xpparam_t; --- 79,85 ---- typedef struct s_xpparam { unsigned long flags; ! // See Documentation/diff-options.txt. char **anchors; size_t anchors_nr; } xpparam_t; *************** *** 130,138 **** int level; int favor; int style; ! const char *ancestor; /* label for orig */ ! const char *file1; /* label for mf1 */ ! const char *file2; /* label for mf2 */ } xmparam_t; #define DEFAULT_CONFLICT_MARKER_SIZE 7 --- 130,138 ---- int level; int favor; int style; ! const char *ancestor; // label for orig ! const char *file1; // label for mf1 ! const char *file2; // label for mf2 } xmparam_t; #define DEFAULT_CONFLICT_MARKER_SIZE 7 *************** *** 142,147 **** #ifdef __cplusplus } ! #endif /* #ifdef __cplusplus */ ! #endif /* #if !defined(XDIFF_H) */ --- 142,147 ---- #ifdef __cplusplus } ! #endif // #ifdef __cplusplus ! #endif // #if !defined(XDIFF_H) *** ../vim-8.1.2388/src/xdiff/xdiffi.h 2018-09-10 17:50:32.713306941 +0200 --- src/xdiff/xdiffi.h 2019-12-04 22:12:58.904935690 +0100 *************** *** 61,64 **** int xdl_do_histogram_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp, xdfenv_t *env); ! #endif /* #if !defined(XDIFFI_H) */ --- 61,64 ---- int xdl_do_histogram_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp, xdfenv_t *env); ! #endif // #if !defined(XDIFFI_H) *** ../vim-8.1.2388/src/xdiff/xemit.h 2018-09-10 17:50:32.713306941 +0200 --- src/xdiff/xemit.h 2019-12-04 22:13:10.340894625 +0100 *************** *** 33,36 **** ! #endif /* #if !defined(XEMIT_H) */ --- 33,36 ---- ! #endif // #if !defined(XEMIT_H) *** ../vim-8.1.2388/src/xdiff/xinclude.h 2019-01-17 17:13:25.924984061 +0100 --- src/xdiff/xinclude.h 2019-12-04 22:13:26.224837630 +0100 *************** *** 20,26 **** * */ ! /* defines HAVE_ATTRIBUTE_UNUSED */ #ifdef HAVE_CONFIG_H # ifdef VMS # include "[.auto]config.h" --- 20,26 ---- * */ ! // defines HAVE_ATTRIBUTE_UNUSED #ifdef HAVE_CONFIG_H # ifdef VMS # include "[.auto]config.h" *************** *** 29,36 **** # endif #endif ! /* Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter ! * can be used to check for mistakes. */ #ifdef HAVE_ATTRIBUTE_UNUSED # define UNUSED __attribute__((unused)) #else --- 29,36 ---- # endif #endif ! // Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter ! // can be used to check for mistakes. #ifdef HAVE_ATTRIBUTE_UNUSED # define UNUSED __attribute__((unused)) #else *************** *** 62,65 **** #include "xemit.h" ! #endif /* #if !defined(XINCLUDE_H) */ --- 62,65 ---- #include "xemit.h" ! #endif // #if !defined(XINCLUDE_H) *** ../vim-8.1.2388/src/xdiff/xmacros.h 2018-09-10 17:50:32.717306902 +0200 --- src/xdiff/xmacros.h 2019-12-04 22:13:37.508797169 +0100 *************** *** 51,54 **** } while (0) ! #endif /* #if !defined(XMACROS_H) */ --- 51,54 ---- } while (0) ! #endif // #if !defined(XMACROS_H) *** ../vim-8.1.2388/src/xdiff/xprepare.h 2018-09-10 17:50:32.717306902 +0200 --- src/xdiff/xprepare.h 2019-12-04 22:13:59.200719452 +0100 *************** *** 31,34 **** ! #endif /* #if !defined(XPREPARE_H) */ --- 31,34 ---- ! #endif // #if !defined(XPREPARE_H) *** ../vim-8.1.2388/src/xdiff/xtypes.h 2018-09-10 17:50:32.717306902 +0200 --- src/xdiff/xtypes.h 2019-12-04 22:14:03.108705461 +0100 *************** *** 64,67 **** ! #endif /* #if !defined(XTYPES_H) */ --- 64,67 ---- ! #endif // #if !defined(XTYPES_H) *** ../vim-8.1.2388/src/xdiff/xutils.h 2018-09-10 17:50:32.717306902 +0200 --- src/xdiff/xutils.h 2019-12-04 22:14:23.220633502 +0100 *************** *** 44,47 **** ! #endif /* #if !defined(XUTILS_H) */ --- 44,47 ---- ! #endif // #if !defined(XUTILS_H) *** ../vim-8.1.2388/src/version.c 2019-12-04 21:57:40.076408354 +0100 --- src/version.c 2019-12-04 22:16:24.180202080 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 2389, /**/ -- hundred-and-one symptoms of being an internet addict: 186. You overstay in the office so you can have more time surfing the net. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///