Mercurial > vim
diff src/xdiff/xpatience.c @ 18802:3be01cf0a632 v8.1.2389
patch 8.1.2389: using old C style comments
Commit: https://github.com/vim/vim/commit/707d226ac58da752ecc6b7620055fb1df3957a27
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Dec 4 22:16:54 2019 +0100
patch 8.1.2389: using old C style comments
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 04 Dec 2019 22:30:07 +0100 |
parents | ef9f4be0bc5b |
children | d5142d87f898 |
line wrap: on
line diff
--- a/src/xdiff/xpatience.c +++ b/src/xdiff/xpatience.c @@ -69,7 +69,7 @@ struct hashmap { */ unsigned anchor : 1; } *entries, *first, *last; - /* were common records found? */ + // were common records found? unsigned long has_matches; mmfile_t *file1, *file2; xdfenv_t *env; @@ -86,7 +86,7 @@ static int is_anchor(xpparam_t const *xp return 0; } -/* The argument "pass" is 1 for the first file, 2 for the second. */ +// 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,7 +155,7 @@ static int fill_hashmap(mmfile_t *file1, result->xpp = xpp; result->env = env; - /* We know exactly how large we want the hash map */ + // 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,11 +163,11 @@ static int fill_hashmap(mmfile_t *file1, return -1; memset(result->entries, 0, result->alloc * sizeof(struct entry)); - /* First, fill with entries from the first file */ + // First, fill with entries from the first file while (count1--) insert_record(xpp, line1++, result, 1); - /* Then search for matches in the second file */ + // Then search for matches in the second file while (count2--) insert_record(xpp, line2++, result, 2); @@ -185,13 +185,13 @@ static int binary_search(struct entry ** while (left + 1 < right) { int middle = left + (right - left) / 2; - /* by construction, no two entries can be equal */ + // 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 the index in "sequence", _not_ the sequence length return left; } @@ -216,7 +216,7 @@ static struct entry *find_longest_common */ int anchor_i = -1; - /* Added to silence Coverity. */ + // Added to silence Coverity. if (sequence == NULL) return map->first; @@ -237,13 +237,13 @@ static struct entry *find_longest_common } } - /* No common unique lines were found */ + // No common unique lines were found if (!longest) { xdl_free(sequence); return NULL; } - /* Iterate starting at the last element, adjusting the "next" members */ + // Iterate starting at the last element, adjusting the "next" members entry = sequence[longest - 1]; entry->next = NULL; while (entry->previous) { @@ -273,7 +273,7 @@ static int walk_common_sequence(struct h int next1, next2; for (;;) { - /* Try to grow the line ranges of common lines */ + // Try to grow the line ranges of common lines if (first) { next1 = first->line1; next2 = first->line2; @@ -292,7 +292,7 @@ static int walk_common_sequence(struct h line2++; } - /* Recurse */ + // Recurse if (next1 > line1 || next2 > line2) { struct hashmap submap; @@ -343,7 +343,7 @@ static int patience_diff(mmfile_t *file1 struct entry *first; int result = 0; - /* trivial case: one side is empty */ + // trivial case: one side is empty if (!count1) { while(count2--) env->xdf2.rchg[line2++ - 1] = 1; @@ -359,7 +359,7 @@ static int patience_diff(mmfile_t *file1 line1, count1, line2, count2)) return -1; - /* are there any matching lines at all? */ + // are there any matching lines at all? if (!map.has_matches) { while(count1--) env->xdf1.rchg[line1++ - 1] = 1; @@ -387,7 +387,7 @@ int xdl_do_patience_diff(mmfile_t *file1 if (xdl_prepare_env(file1, file2, xpp, env) < 0) return -1; - /* environment is cleaned up in xdl_diff() */ + // environment is cleaned up in xdl_diff() return patience_diff(file1, file2, xpp, env, 1, env->xdf1.nrec, 1, env->xdf2.nrec); }