Re: [PATCH v3 1/2] merge-file: let conflict markers match end-of-line style of the context
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 25, 2016, 08:59 UTC
- Message-ID
- <alpine.DEB.2.20.1601250958330.2964@virtualbox>
- In-Reply-To
- <56A5DDA8.1030404@web.de>
Hi Torsten,
On Mon, 25 Jan 2016, Torsten Bögershausen wrote:
Show 22 quoted lines
> On 25.01.16 09:07, Johannes Schindelin wrote: > [] > > diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c > > index 625198e..c852acc 100644 > > --- a/xdiff/xmerge.c > > +++ b/xdiff/xmerge.c > > @@ -143,6 +143,35 @@ static int xdl_orig_copy(xdfenv_t *xe, int i, int count, int add_nl, char *dest) > > return xdl_recs_copy_0(1, xe, i, count, add_nl, dest); > > } > > > > +/* > > + * Returns 1 if the i'th line ends in CR/LF (if it is the last line and > > + * has no eol, the preceding line, if any), 0 if it ends in LF-only, and > > + * -1 if the line ending cannot be determined. > > + */ > > +static int is_eol_crlf(xdfile_t *file, int i) > Minot nit: Could that be > is_eol_crlf(xdfile_t *file, int lineno) > (or may be) > is_eol_crlf(const xdfile_t *file, int lineno) > (or may be) > has_eol_crlf(const xdfile_t *file, int lineno)
The surrounding code consistently uses i, and not lineno. The reason (I guess) is that i starts at 0 whereas lineno would have to start at 1, and we can easily avoid adding and subtracting 1 all the time.
Ciao, Dscho