summaryrefslogtreecommitdiff
path: root/src/xdiff/xhistogram.c
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2021-08-31 20:46:39 +0200
committerBram Moolenaar <Bram@vim.org>2021-08-31 20:46:39 +0200
commitba02e4720f863fdb456e7023520f0a354eec0dcf (patch)
tree84db07f22b6ef54c238bc462823703ad11ff3872 /src/xdiff/xhistogram.c
parentdca29d9cf46cd1d4d4519211c7af78b6b1c56960 (diff)
downloadvim-git-ba02e4720f863fdb456e7023520f0a354eec0dcf.tar.gz
patch 8.2.3390: included xdiff code is outdatedv8.2.3390
Problem: Included xdiff code is outdated. Solution: Sync with xdiff in git 2.33. (Christian Brabandt, closes #8431)
Diffstat (limited to 'src/xdiff/xhistogram.c')
-rw-r--r--src/xdiff/xhistogram.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/xdiff/xhistogram.c b/src/xdiff/xhistogram.c
index 28cf8258e..8598a8550 100644
--- a/src/xdiff/xhistogram.c
+++ b/src/xdiff/xhistogram.c
@@ -42,8 +42,6 @@
*/
#include "xinclude.h"
-#include "xtypes.h"
-#include "xdiff.h"
#define MAX_PTR INT_MAX
#define MAX_CNT INT_MAX
@@ -55,8 +53,8 @@ struct histindex {
struct record {
unsigned int ptr, cnt;
struct record *next;
- } **records, // an occurrence
- **line_map; // map of line to record chain
+ } **records, /* an occurrence */
+ **line_map; /* map of line to record chain */
chastore_t rcha;
unsigned int *next_ptrs;
unsigned int table_bits,
@@ -128,7 +126,7 @@ static int scanA(struct histindex *index, int line1, int count1)
*/
NEXT_PTR(index, ptr) = rec->ptr;
rec->ptr = ptr;
- // cap rec->cnt at MAX_CNT
+ /* cap rec->cnt at MAX_CNT */
rec->cnt = XDL_MIN(MAX_CNT, rec->cnt + 1);
LINE_MAP(index, ptr) = rec;
goto continue_scan;
@@ -154,7 +152,7 @@ static int scanA(struct histindex *index, int line1, int count1)
LINE_MAP(index, ptr) = rec;
continue_scan:
- ; // no op
+ ; /* no op */
}
return 0;
@@ -237,6 +235,8 @@ static int fall_back_to_classic_diff(xpparam_t const *xpp, xdfenv_t *env,
int line1, int count1, int line2, int count2)
{
xpparam_t xpparam;
+
+ memset(&xpparam, 0, sizeof(xpparam));
xpparam.flags = xpp->flags & ~XDF_DIFF_ALGORITHM_MASK;
return xdl_fall_back_diff(env, &xpparam,
@@ -266,7 +266,7 @@ static int find_lcs(xpparam_t const *xpp, xdfenv_t *env,
index.records = NULL;
index.line_map = NULL;
- // in case of early xdl_cha_free()
+ /* in case of early xdl_cha_free() */
index.rcha.head = NULL;
index.table_bits = xdl_hashbits(count1);
@@ -288,7 +288,7 @@ static int find_lcs(xpparam_t const *xpp, xdfenv_t *env,
goto cleanup;
memset(index.next_ptrs, 0, sz);
- // lines / 4 + 1 comes from xprepare.c:xdl_prepare_ctx()
+ /* 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;