mirror of
https://github.com/vim/vim.git
synced 2025-09-10 22:33:40 -04:00
patch 8.1.2389: using old C style comments
Problem: Using old C style comments. Solution: Use // comments where appropriate.
This commit is contained in:
parent
4ba37b5833
commit
707d226ac5
@ -216,14 +216,13 @@ void vterm_mouse_button(VTerm *vt, int button, int pressed, VTermModifier mod);
|
||||
// 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.
|
||||
*/
|
||||
// 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,7 +356,7 @@ VTermScreen *vterm_obtain_screen(VTerm *vt);
|
||||
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 */
|
||||
// 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);
|
||||
|
||||
|
@ -773,7 +773,7 @@ int vterm_screen_get_cell(const VTermScreen *screen, VTermPos pos, VTermScreenCe
|
||||
cell->bg = intcell->pen.bg;
|
||||
|
||||
if(vterm_get_special_pty_type() == 2) {
|
||||
/* Get correct cell width from cell information contained in line buffer */
|
||||
// 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,8 +798,10 @@ int vterm_screen_get_cell(const VTermScreen *screen, VTermPos pos, VTermScreenCe
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Copy external to internal representation of a screen cell
|
||||
/* static because it's only used internally for sb_popline during resize */
|
||||
/*
|
||||
* 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);
|
||||
|
@ -452,7 +452,7 @@ static int mk_wcwidth(uint32_t ucs)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0 /* unused */
|
||||
#if 0 // unused
|
||||
static int mk_wcswidth(const uint32_t *pwcs, size_t n)
|
||||
{
|
||||
int w, width = 0;
|
||||
@ -479,8 +479,8 @@ static int mk_wcswidth(const uint32_t *pwcs, size_t n)
|
||||
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" */
|
||||
// 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 },
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
#include "utf8.h"
|
||||
|
||||
/*****************
|
||||
* API functions *
|
||||
*****************/
|
||||
///////////////////
|
||||
// API functions //
|
||||
///////////////////
|
||||
|
||||
static void *default_malloc(size_t size, void *allocdata UNUSED)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "vterm.h"
|
||||
#include "../src/vterm_internal.h" /* We pull in some internal bits too */
|
||||
#include "../src/vterm_internal.h" // We pull in some internal bits too
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -163,16 +163,16 @@ static int parser_dcs(const char *command, size_t cmdlen, void *user)
|
||||
}
|
||||
|
||||
static VTermParserCallbacks parser_cbs = {
|
||||
parser_text, /* text */
|
||||
parser_control, /* control */
|
||||
parser_escape, /* escape */
|
||||
parser_csi, /* csi */
|
||||
parser_osc, /* osc */
|
||||
parser_dcs, /* dcs */
|
||||
NULL /* resize */
|
||||
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 */
|
||||
// These callbacks are shared by State and Screen
|
||||
|
||||
static int want_movecursor = 0;
|
||||
static VTermPos state_pos;
|
||||
@ -241,7 +241,7 @@ static int settermprop(VTermProp prop, VTermValue *val, void *user)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* These callbacks are for State */
|
||||
// These callbacks are for State
|
||||
|
||||
static int want_state_putglyph = 0;
|
||||
static int state_putglyph(VTermGlyphInfo *info, VTermPos pos, void *user)
|
||||
@ -333,17 +333,17 @@ static int state_setlineinfo(int row, const VTermLineInfo *newinfo, const VTermL
|
||||
}
|
||||
|
||||
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 */
|
||||
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,7 +427,7 @@ static int screen_sb_popline(int cols, VTermScreenCell *cells, void *user)
|
||||
if(!want_screen_scrollback)
|
||||
return 0;
|
||||
|
||||
/* All lines of scrollback contain "ABCDE" */
|
||||
// All lines of scrollback contain "ABCDE"
|
||||
for(col = 0; col < cols; col++) {
|
||||
if(col < 5)
|
||||
cells[col].chars[0] = 'A' + col;
|
||||
@ -442,14 +442,14 @@ static int screen_sb_popline(int cols, VTermScreenCell *cells, void *user)
|
||||
}
|
||||
|
||||
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 */
|
||||
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,9 +592,8 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
else if(streq(line, "WANTENCODING")) {
|
||||
/* This isn't really external API but it's hard to get this out any
|
||||
* other way
|
||||
*/
|
||||
// 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,7 +832,7 @@ int main(int argc, char **argv)
|
||||
else if(len == 0)
|
||||
printf("\n");
|
||||
else {
|
||||
/* Put an overwrite guard at both ends of the buffer */
|
||||
// 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;
|
||||
|
@ -742,6 +742,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2389,
|
||||
/**/
|
||||
2388,
|
||||
/**/
|
||||
|
@ -25,9 +25,9 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* #ifdef __cplusplus */
|
||||
#endif // #ifdef __cplusplus
|
||||
|
||||
/* xpparm_t.flags */
|
||||
// xpparm_t.flags
|
||||
#define XDF_NEED_MINIMAL (1 << 0)
|
||||
|
||||
#define XDF_IGNORE_WHITESPACE (1 << 1)
|
||||
@ -48,22 +48,22 @@ extern "C" {
|
||||
|
||||
#define XDF_INDENT_HEURISTIC (1 << 23)
|
||||
|
||||
/* xdemitconf_t.flags */
|
||||
// xdemitconf_t.flags
|
||||
#define XDL_EMIT_FUNCNAMES (1 << 0)
|
||||
#define XDL_EMIT_FUNCCONTEXT (1 << 2)
|
||||
|
||||
/* merge simplification levels */
|
||||
// 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 */
|
||||
// merge favor modes
|
||||
#define XDL_MERGE_FAVOR_OURS 1
|
||||
#define XDL_MERGE_FAVOR_THEIRS 2
|
||||
#define XDL_MERGE_FAVOR_UNION 3
|
||||
|
||||
/* merge output styles */
|
||||
// merge output styles
|
||||
#define XDL_MERGE_DIFF3 1
|
||||
|
||||
typedef struct s_mmfile {
|
||||
@ -79,7 +79,7 @@ typedef struct s_mmbuffer {
|
||||
typedef struct s_xpparam {
|
||||
unsigned long flags;
|
||||
|
||||
/* See Documentation/diff-options.txt. */
|
||||
// See Documentation/diff-options.txt.
|
||||
char **anchors;
|
||||
size_t anchors_nr;
|
||||
} xpparam_t;
|
||||
@ -130,9 +130,9 @@ typedef struct s_xmparam {
|
||||
int level;
|
||||
int favor;
|
||||
int style;
|
||||
const char *ancestor; /* label for orig */
|
||||
const char *file1; /* label for mf1 */
|
||||
const char *file2; /* label for mf2 */
|
||||
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,6 +142,6 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, mmfile_t *mf2,
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* #ifdef __cplusplus */
|
||||
#endif // #ifdef __cplusplus
|
||||
|
||||
#endif /* #if !defined(XDIFF_H) */
|
||||
#endif // #if !defined(XDIFF_H)
|
||||
|
@ -418,24 +418,24 @@ static int xget_indent(xrecord_t *rec)
|
||||
ret += 1;
|
||||
else if (c == '\t')
|
||||
ret += 8 - ret % 8;
|
||||
/* ignore other whitespace characters */
|
||||
// ignore other whitespace characters
|
||||
|
||||
if (ret >= MAX_INDENT)
|
||||
return MAX_INDENT;
|
||||
}
|
||||
|
||||
/* The line contains only whitespace. */
|
||||
// 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.
|
||||
* 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. */
|
||||
// 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,10 +472,10 @@ struct split_measurement {
|
||||
};
|
||||
|
||||
struct split_score {
|
||||
/* The effective indent of this split (smaller is preferred). */
|
||||
// The effective indent of this split (smaller is preferred).
|
||||
int effective_indent;
|
||||
|
||||
/* Penalty for this split (smaller is preferred). */
|
||||
// Penalty for this split (smaller is preferred).
|
||||
int penalty;
|
||||
};
|
||||
|
||||
@ -534,16 +534,16 @@ static void measure_split(const xdfile_t *xdf, long split,
|
||||
* integer math.
|
||||
*/
|
||||
|
||||
/* Penalty if there are no non-blank lines before the split */
|
||||
// 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 */
|
||||
// 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 */
|
||||
// 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 */
|
||||
// Multiplier for the number of blank lines after the split
|
||||
#define POST_BLANK_WEIGHT 6
|
||||
|
||||
/*
|
||||
@ -610,7 +610,7 @@ static void score_add_split(const struct split_measurement *m, struct split_scor
|
||||
post_blank = (m->indent == -1) ? 1 + m->post_blank : 0;
|
||||
total_blank = m->pre_blank + post_blank;
|
||||
|
||||
/* Penalties based on nearby blank lines: */
|
||||
// Penalties based on nearby blank lines:
|
||||
s->penalty += TOTAL_BLANK_WEIGHT * total_blank;
|
||||
s->penalty += POST_BLANK_WEIGHT * post_blank;
|
||||
|
||||
@ -621,13 +621,13 @@ static void score_add_split(const struct split_measurement *m, struct split_scor
|
||||
|
||||
any_blanks = (total_blank != 0);
|
||||
|
||||
/* Note that the effective indent is -1 at the end of the file: */
|
||||
// Note that the effective indent is -1 at the end of the file:
|
||||
s->effective_indent += indent;
|
||||
|
||||
if (indent == -1) {
|
||||
/* No additional adjustments needed. */
|
||||
// No additional adjustments needed.
|
||||
} else if (m->pre_indent == -1) {
|
||||
/* No additional adjustments needed. */
|
||||
// No additional adjustments needed.
|
||||
} else if (indent > m->pre_indent) {
|
||||
/*
|
||||
* The line is indented more than its predecessor.
|
||||
@ -669,7 +669,7 @@ static void score_add_split(const struct split_measurement *m, struct split_scor
|
||||
|
||||
static int score_cmp(struct split_score *s1, struct split_score *s2)
|
||||
{
|
||||
/* -1 if s1.effective_indent < s2->effective_indent, etc. */
|
||||
// -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,7 +809,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
|
||||
group_init(xdfo, &go);
|
||||
|
||||
while (1) {
|
||||
/* If the group is empty in the to-be-compacted file, skip it: */
|
||||
// If the group is empty in the to-be-compacted file, skip it:
|
||||
if (g.end == g.start)
|
||||
goto next;
|
||||
|
||||
@ -828,7 +828,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
|
||||
*/
|
||||
end_matching_other = -1;
|
||||
|
||||
/* Shift the group backward as much as possible: */
|
||||
// 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,7 +842,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
|
||||
if (go.end > go.start)
|
||||
end_matching_other = g.end;
|
||||
|
||||
/* Now shift the group forward as far as possible: */
|
||||
// Now shift the group forward as far as possible:
|
||||
while (1) {
|
||||
if (group_slide_down(xdf, &g, flags))
|
||||
break;
|
||||
@ -863,7 +863,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
|
||||
*/
|
||||
|
||||
if (g.end == earliest_end) {
|
||||
/* no shifting was possible */
|
||||
// no shifting was possible
|
||||
} else if (end_matching_other != -1) {
|
||||
/*
|
||||
* Move the possibly merged group of changes back to line
|
||||
@ -921,7 +921,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
|
||||
}
|
||||
|
||||
next:
|
||||
/* Move past the just-processed group: */
|
||||
// Move past the just-processed group:
|
||||
if (group_next(xdf, &g))
|
||||
break;
|
||||
if (group_next(xdfo, &go))
|
||||
|
@ -61,4 +61,4 @@ int xdl_do_patience_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
|
||||
int xdl_do_histogram_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
|
||||
xdfenv_t *env);
|
||||
|
||||
#endif /* #if !defined(XDIFFI_H) */
|
||||
#endif // #if !defined(XDIFFI_H)
|
||||
|
@ -54,9 +54,9 @@ xdchange_t *xdl_get_hunk(xdchange_t **xscr, xdemitconf_t const *xecfg)
|
||||
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 */
|
||||
unsigned long ignored = 0; // number of ignored blank lines
|
||||
|
||||
/* remove ignorable changes that are too far before other changes */
|
||||
// remove ignorable changes that are too far before other changes
|
||||
for (xchp = *xscr; xchp && xchp->ignore; xchp = xchp->next) {
|
||||
xch = xchp->next;
|
||||
|
||||
@ -99,9 +99,9 @@ xdchange_t *xdl_get_hunk(xdchange_t **xscr, xdemitconf_t const *xecfg)
|
||||
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 */
|
||||
(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,7 +197,7 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
|
||||
if (xecfg->flags & XDL_EMIT_FUNCCONTEXT) {
|
||||
long fs1, i1 = xch->i1;
|
||||
|
||||
/* Appended chunk? */
|
||||
// Appended chunk?
|
||||
if (i1 >= xe->xdf1.nrec) {
|
||||
long i2 = xch->i2;
|
||||
|
||||
|
@ -33,4 +33,4 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
|
||||
|
||||
|
||||
|
||||
#endif /* #if !defined(XEMIT_H) */
|
||||
#endif // #if !defined(XEMIT_H)
|
||||
|
@ -55,8 +55,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 +128,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 +154,7 @@ static int scanA(struct histindex *index, int line1, int count1)
|
||||
LINE_MAP(index, ptr) = rec;
|
||||
|
||||
continue_scan:
|
||||
; /* no op */
|
||||
; // no op
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -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;
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* defines HAVE_ATTRIBUTE_UNUSED */
|
||||
// defines HAVE_ATTRIBUTE_UNUSED
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# ifdef VMS
|
||||
# include "[.auto]config.h"
|
||||
@ -29,8 +29,8 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter
|
||||
* can be used to check for mistakes. */
|
||||
// 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,4 +62,4 @@
|
||||
#include "xemit.h"
|
||||
|
||||
|
||||
#endif /* #if !defined(XINCLUDE_H) */
|
||||
#endif // #if !defined(XINCLUDE_H)
|
||||
|
@ -51,4 +51,4 @@ do { \
|
||||
} while (0)
|
||||
|
||||
|
||||
#endif /* #if !defined(XMACROS_H) */
|
||||
#endif // #if !defined(XMACROS_H)
|
||||
|
@ -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 *xpp, const char *line)
|
||||
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, mmfile_t *file2,
|
||||
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, mmfile_t *file2,
|
||||
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 **sequence, int longest,
|
||||
|
||||
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_sequence(struct hashmap *map)
|
||||
*/
|
||||
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_sequence(struct hashmap *map)
|
||||
}
|
||||
}
|
||||
|
||||
/* 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 hashmap *map, struct entry *first,
|
||||
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 hashmap *map, struct entry *first,
|
||||
line2++;
|
||||
}
|
||||
|
||||
/* Recurse */
|
||||
// Recurse
|
||||
if (next1 > line1 || next2 > line2) {
|
||||
struct hashmap submap;
|
||||
|
||||
@ -343,7 +343,7 @@ static int patience_diff(mmfile_t *file1, mmfile_t *file2,
|
||||
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, mmfile_t *file2,
|
||||
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, mmfile_t *file2,
|
||||
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);
|
||||
}
|
||||
|
@ -31,4 +31,4 @@ void xdl_free_env(xdfenv_t *xe);
|
||||
|
||||
|
||||
|
||||
#endif /* #if !defined(XPREPARE_H) */
|
||||
#endif // #if !defined(XPREPARE_H)
|
||||
|
@ -64,4 +64,4 @@ typedef struct s_xdfenv {
|
||||
|
||||
|
||||
|
||||
#endif /* #if !defined(XTYPES_H) */
|
||||
#endif // #if !defined(XTYPES_H)
|
||||
|
@ -168,7 +168,7 @@ static int ends_with_optional_cr(const char *l, long s, long i)
|
||||
s--;
|
||||
if (s == i)
|
||||
return 1;
|
||||
/* do not ignore CR at the end of an incomplete line */
|
||||
// do not ignore CR at the end of an incomplete line
|
||||
if (complete && s == i + 1 && l[i] == '\r')
|
||||
return 1;
|
||||
return 0;
|
||||
@ -208,7 +208,7 @@ int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
|
||||
} 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 */
|
||||
// Skip matching spaces and try again
|
||||
while (i1 < s1 && XDL_ISSPACE(l1[i1]))
|
||||
i1++;
|
||||
while (i2 < s2 && XDL_ISSPACE(l2[i2]))
|
||||
@ -224,7 +224,7 @@ int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags)
|
||||
i2++;
|
||||
}
|
||||
} else if (flags & XDF_IGNORE_CR_AT_EOL) {
|
||||
/* Find the first difference and see how the line ends */
|
||||
// Find the first difference and see how the line ends
|
||||
while (i1 < s1 && i2 < s2 && l1[i1] == l2[i2]) {
|
||||
i1++;
|
||||
i2++;
|
||||
@ -261,7 +261,7 @@ static unsigned long xdl_hash_record_with_whitespace(char const **data,
|
||||
|
||||
for (; ptr < top && *ptr != '\n'; ptr++) {
|
||||
if (cr_at_eol_only) {
|
||||
/* do not ignore CR at the end of an incomplete line */
|
||||
// do not ignore CR at the end of an incomplete line
|
||||
if (*ptr == '\r' &&
|
||||
(ptr + 1 < top && ptr[1] == '\n'))
|
||||
continue;
|
||||
@ -274,7 +274,7 @@ static unsigned long xdl_hash_record_with_whitespace(char const **data,
|
||||
ptr++;
|
||||
at_eol = (top <= ptr + 1 || ptr[1] == '\n');
|
||||
if (flags & XDF_IGNORE_WHITESPACE)
|
||||
; /* already handled */
|
||||
; // already handled
|
||||
else if (flags & XDF_IGNORE_WHITESPACE_CHANGE
|
||||
&& !at_eol) {
|
||||
ha += (ha << 5);
|
||||
|
@ -44,4 +44,4 @@ int xdl_fall_back_diff(xdfenv_t *diff_env, xpparam_t const *xpp,
|
||||
|
||||
|
||||
|
||||
#endif /* #if !defined(XUTILS_H) */
|
||||
#endif // #if !defined(XUTILS_H)
|
||||
|
Loading…
x
Reference in New Issue
Block a user