summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-02-15 21:06:09 +0100
committerBram Moolenaar <Bram@vim.org>2019-02-15 21:06:09 +0100
commit00590740081489db69f43d9f1c0e3f70e29ce6da (patch)
tree5200046e5c39885c50b5057cca9110975a629eb5
parente93e5a504f481bd0dad9c504d5fcf0e5f0dfc6e6 (diff)
downloadvim-git-00590740081489db69f43d9f1c0e3f70e29ce6da.tar.gz
patch 8.1.0927: USE_CR is never definedv8.1.0927
Problem: USE_CR is never defined. Solution: Remove usage of USE_CR. (Ken Takata, closes #3958)
-rw-r--r--runtime/doc/options.txt10
-rw-r--r--src/diff.c12
-rw-r--r--src/evalfunc.c16
-rw-r--r--src/ex_cmds2.c110
-rw-r--r--src/fileio.c53
-rw-r--r--src/message.c5
-rw-r--r--src/ops.c4
-rw-r--r--src/option.h21
-rw-r--r--src/proto/ex_cmds2.pro1
-rw-r--r--src/proto/fileio.pro1
-rw-r--r--src/tag.c18
-rw-r--r--src/version.c2
12 files changed, 29 insertions, 224 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 6b2dde825..3b62c0f53 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -3134,9 +3134,8 @@ A jump table for the options with a short description can be found at |Q_op|.
is read.
*'fileformat'* *'ff'*
-'fileformat' 'ff' string (MS-DOS, MS-Windows, OS/2 default: "dos",
- Unix default: "unix",
- Macintosh default: "mac")
+'fileformat' 'ff' string (MS-Windows default: "dos",
+ Unix, macOS default: "unix")
local to buffer
{not in Vi}
This gives the <EOL> of the current buffer, which is used for
@@ -3159,9 +3158,8 @@ A jump table for the options with a short description can be found at |Q_op|.
*'fileformats'* *'ffs'*
'fileformats' 'ffs' string (default:
- Vim+Vi MS-DOS, MS-Windows OS/2: "dos,unix",
- Vim Unix: "unix,dos",
- Vim Mac: "mac,unix,dos",
+ Vim+Vi MS-Windows: "dos,unix",
+ Vim Unix, macOS: "unix,dos",
Vi Cygwin: "unix,dos",
Vi others: "")
global
diff --git a/src/diff.c b/src/diff.c
index d368f9697..9220c7214 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -90,10 +90,6 @@ static int parse_diff_ed(char_u *line, linenr_T *lnum_orig, long *count_orig, li
static int parse_diff_unified(char_u *line, linenr_T *lnum_orig, long *count_orig, linenr_T *lnum_new, long *count_new);
static int xdiff_out(void *priv, mmbuffer_t *mb, int nbuf);
-#ifndef USE_CR
-# define tag_fgets vim_fgets
-#endif
-
/*
* Called when deleting or unloading a buffer: No longer make a diff with it.
*/
@@ -996,7 +992,7 @@ check_external_diff(diffio_T *diffio)
for (;;)
{
/* There must be a line that contains "1c1". */
- if (tag_fgets(linebuf, LBUFLEN, fd))
+ if (vim_fgets(linebuf, LBUFLEN, fd))
break;
if (STRNCMP(linebuf, "1c1", 3) == 0)
ok = TRUE;
@@ -1604,7 +1600,7 @@ diff_read(
}
else
{
- if (tag_fgets(linebuf, LBUFLEN, fd))
+ if (vim_fgets(linebuf, LBUFLEN, fd))
break; // end of file
line = linebuf;
}
@@ -1626,9 +1622,9 @@ diff_read(
else if ((STRNCMP(line, "@@ ", 3) == 0))
diffstyle = DIFF_UNIFIED;
else if ((STRNCMP(line, "--- ", 4) == 0)
- && (tag_fgets(linebuf, LBUFLEN, fd) == 0)
+ && (vim_fgets(linebuf, LBUFLEN, fd) == 0)
&& (STRNCMP(line, "+++ ", 4) == 0)
- && (tag_fgets(linebuf, LBUFLEN, fd) == 0)
+ && (vim_fgets(linebuf, LBUFLEN, fd) == 0)
&& (STRNCMP(line, "@@ ", 3) == 0))
diffstyle = DIFF_UNIFIED;
else
diff --git a/src/evalfunc.c b/src/evalfunc.c
index e693ef913..f1cb9dc60 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -13431,20 +13431,7 @@ get_cmd_output_as_rettv(
else
{
res = get_cmd_output(tv_get_string(&argvars[0]), infile, flags, NULL);
-#ifdef USE_CR
- /* translate <CR> into <NL> */
- if (res != NULL)
- {
- char_u *s;
-
- for (s = res; *s; ++s)
- {
- if (*s == CAR)
- *s = NL;
- }
- }
-#else
-# ifdef USE_CRNL
+#ifdef USE_CRNL
/* translate <CR><NL> into <NL> */
if (res != NULL)
{
@@ -13459,7 +13446,6 @@ get_cmd_output_as_rettv(
}
*d = NUL;
}
-# endif
#endif
rettv->vval.v_string = res;
res = NULL;
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 30efcdf83..a72302571 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -1359,7 +1359,7 @@ check_due_timer(void)
did_throw = FALSE;
current_exception = NULL;
save_vimvars(&vvsave);
-
+ch_log(NULL, "calling timer callback");
timer->tr_firing = TRUE;
timer_callback(timer);
timer->tr_firing = FALSE;
@@ -4243,7 +4243,7 @@ struct source_cookie
FILE *fp; /* opened file for sourcing */
char_u *nextline; /* if not NULL: line that was read ahead */
int finished; /* ":finish" used */
-#if defined(USE_CRNL) || defined(USE_CR)
+#ifdef USE_CRNL
int fileformat; /* EOL_UNKNOWN, EOL_UNIX or EOL_DOS */
int error; /* TRUE if LF found after CR-LF */
#endif
@@ -4465,15 +4465,6 @@ do_source(
cookie.error = FALSE;
#endif
-#ifdef USE_CR
- /* If no automatic file format: Set default to CR. */
- if (*p_ffs == NUL)
- cookie.fileformat = EOL_MAC;
- else
- cookie.fileformat = EOL_UNKNOWN;
- cookie.error = FALSE;
-#endif
-
cookie.nextline = NULL;
cookie.finished = FALSE;
@@ -4768,59 +4759,6 @@ free_scriptnames(void)
#endif
-#if defined(USE_CR) || defined(PROTO)
-
-# if defined(__MSL__) && (__MSL__ >= 22)
-/*
- * Newer version of the Metrowerks library handle DOS and UNIX files
- * without help.
- * Test with earlier versions, MSL 2.2 is the library supplied with
- * Codewarrior Pro 2.
- */
- char *
-fgets_cr(char *s, int n, FILE *stream)
-{
- return fgets(s, n, stream);
-}
-# else
-/*
- * Version of fgets() which also works for lines ending in a <CR> only
- * (Macintosh format).
- * For older versions of the Metrowerks library.
- * At least CodeWarrior 9 needed this code.
- */
- char *
-fgets_cr(char *s, int n, FILE *stream)
-{
- int c = 0;
- int char_read = 0;
-
- while (!feof(stream) && c != '\r' && c != '\n' && char_read < n - 1)
- {
- c = fgetc(stream);
- s[char_read++] = c;
- /* If the file is in DOS format, we need to skip a NL after a CR. I
- * thought it was the other way around, but this appears to work... */
- if (c == '\n')
- {
- c = fgetc(stream);
- if (c != '\r')
- ungetc(c, stream);
- }
- }
-
- s[char_read] = 0;
- if (char_read == 0)
- return NULL;
-
- if (feof(stream) && char_read == 1)
- return NULL;
-
- return s;
-}
-# endif
-#endif
-
/*
* Get one full line from a sourced file.
* Called by do_cmdline() when it's called from do_source().
@@ -4954,9 +4892,6 @@ get_one_sourceline(struct source_cookie *sp)
#ifdef USE_CRNL
int has_cr; /* CR-LF found */
#endif
-#ifdef USE_CR
- char_u *scan;
-#endif
int have_read = FALSE;
/* use a growarray to store the sourced line */
@@ -4973,18 +4908,9 @@ get_one_sourceline(struct source_cookie *sp)
break;
buf = (char_u *)ga.ga_data;
-#ifdef USE_CR
- if (sp->fileformat == EOL_MAC)
- {
- if (fgets_cr((char *)buf + ga.ga_len, ga.ga_maxlen - ga.ga_len,
+ if (fgets((char *)buf + ga.ga_len, ga.ga_maxlen - ga.ga_len,
sp->fp) == NULL)
- break;
- }
- else
-#endif
- if (fgets((char *)buf + ga.ga_len, ga.ga_maxlen - ga.ga_len,
- sp->fp) == NULL)
- break;
+ break;
len = ga.ga_len + (int)STRLEN(buf + ga.ga_len);
#ifdef USE_CRNL
/* Ignore a trailing CTRL-Z, when in Dos mode. Only recognize the
@@ -4998,34 +4924,6 @@ get_one_sourceline(struct source_cookie *sp)
}
#endif
-#ifdef USE_CR
- /* If the read doesn't stop on a new line, and there's
- * some CR then we assume a Mac format */
- if (sp->fileformat == EOL_UNKNOWN)
- {
- if (buf[len - 1] != '\n' && vim_strchr(buf, '\r') != NULL)
- sp->fileformat = EOL_MAC;
- else
- sp->fileformat = EOL_UNIX;
- }
-
- if (sp->fileformat == EOL_MAC)
- {
- scan = vim_strchr(buf, '\r');
-
- if (scan != NULL)
- {
- *scan = '\n';
- if (*(scan + 1) != 0)
- {
- *(scan + 1) = 0;
- fseek(sp->fp, (long)(scan - buf - len + 1), SEEK_CUR);
- }
- }
- len = STRLEN(buf);
- }
-#endif
-
have_read = TRUE;
ga.ga_len = len;
diff --git a/src/fileio.c b/src/fileio.c
index f9e18d413..85d2df3bb 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5216,14 +5216,12 @@ msg_add_fileformat(int eol_type)
return TRUE;
}
#endif
-#ifndef USE_CR
if (eol_type == EOL_MAC)
{
STRCAT(IObuff, shortmess(SHM_TEXT) ? _("[mac]") : _("[mac format]"));
return TRUE;
}
-#endif
-#if defined(USE_CRNL) || defined(USE_CR)
+#ifdef USE_CRNL
if (eol_type == EOL_UNIX)
{
STRCAT(IObuff, shortmess(SHM_TEXT) ? _("[unix]") : _("[unix format]"));
@@ -6359,11 +6357,7 @@ vim_fgets(char_u *buf, int size, FILE *fp)
char tbuf[FGETS_SIZE];
buf[size - 2] = NUL;
-#ifdef USE_CR
- eof = fgets_cr((char *)buf, size, fp);
-#else
eof = fgets((char *)buf, size, fp);
-#endif
if (buf[size - 2] != NUL && buf[size - 2] != '\n')
{
buf[size - 1] = NUL; /* Truncate the line */
@@ -6372,57 +6366,12 @@ vim_fgets(char_u *buf, int size, FILE *fp)
do
{
tbuf[FGETS_SIZE - 2] = NUL;
-#ifdef USE_CR
- vim_ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp);
-#else
vim_ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp);
-#endif
} while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n');
}
return (eof == NULL);
}
-#if defined(USE_CR) || defined(PROTO)
-/*
- * Like vim_fgets(), but accept any line terminator: CR, CR-LF or LF.
- * Returns TRUE for end-of-file.
- * Only used for the Mac, because it's much slower than vim_fgets().
- */
- int
-tag_fgets(char_u *buf, int size, FILE *fp)
-{
- int i = 0;
- int c;
- int eof = FALSE;
-
- for (;;)
- {
- c = fgetc(fp);
- if (c == EOF)
- {
- eof = TRUE;
- break;
- }
- if (c == '\r')
- {
- /* Always store a NL for end-of-line. */
- if (i < size - 1)
- buf[i++] = '\n';
- c = fgetc(fp);
- if (c != '\n') /* Macintosh format: single CR. */
- ungetc(c, fp);
- break;
- }
- if (i < size - 1)
- buf[i++] = c;
- if (c == '\n')
- break;
- }
- buf[i] = NUL;
- return eof;
-}
-#endif
-
/*
* rename() only works if both files are on the same file system, this
* function will (attempts to?) copy the file across if rename fails -- webb
diff --git a/src/message.c b/src/message.c
index 82772fdbc..ed59d1b43 100644
--- a/src/message.c
+++ b/src/message.c
@@ -2590,10 +2590,7 @@ msg_puts_printf(char_u *str, int maxlen)
memcpy(buf, p, n);
if (!info_message)
buf[n++] = CAR;
-#ifdef USE_CR
- else
-#endif
- buf[n++] = NL;
+ buf[n++] = NL;
buf[n++] = NUL;
if (info_message) // informative message, not an error
mch_msg((char *)buf);
diff --git a/src/ops.c b/src/ops.c
index dacbfd87c..c5e2be5e5 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -6577,11 +6577,7 @@ clip_convert_selection(char_u **str, long_u *len, VimClipboard *cbd)
#ifdef USE_CRNL
p[i++] = '\r';
#endif
-#ifdef USE_CR
- p[i] = '\r';
-#else
p[i] = '\n';
-#endif
lnum++;
j = -1;
}
diff --git a/src/option.h b/src/option.h
index 26e5fd04c..2f1d322bf 100644
--- a/src/option.h
+++ b/src/option.h
@@ -50,21 +50,14 @@
# define DFLT_FFS_VI "dos,unix" /* also autodetect in compatible mode */
# define DFLT_TEXTAUTO TRUE
#else
-# ifdef USE_CR
-# define DFLT_FF "mac"
-# define DFLT_FFS_VIM "mac,unix,dos"
-# define DFLT_FFS_VI "mac,unix,dos"
-# define DFLT_TEXTAUTO TRUE
+# define DFLT_FF "unix"
+# define DFLT_FFS_VIM "unix,dos"
+# ifdef __CYGWIN__
+# define DFLT_FFS_VI "unix,dos" /* Cygwin always needs file detection */
+# define DFLT_TEXTAUTO TRUE
# else
-# define DFLT_FF "unix"
-# define DFLT_FFS_VIM "unix,dos"
-# ifdef __CYGWIN__
-# define DFLT_FFS_VI "unix,dos" /* Cygwin always needs file detection */
-# define DFLT_TEXTAUTO TRUE
-# else
-# define DFLT_FFS_VI ""
-# define DFLT_TEXTAUTO FALSE
-# endif
+# define DFLT_FFS_VI ""
+# define DFLT_TEXTAUTO FALSE
# endif
#endif
diff --git a/src/proto/ex_cmds2.pro b/src/proto/ex_cmds2.pro
index ac9b291e5..01d20db63 100644
--- a/src/proto/ex_cmds2.pro
+++ b/src/proto/ex_cmds2.pro
@@ -93,7 +93,6 @@ void ex_scriptnames(exarg_T *eap);
void scriptnames_slash_adjust(void);
char_u *get_scriptname(scid_T id);
void free_scriptnames(void);
-char *fgets_cr(char *s, int n, FILE *stream);
char_u *getsourceline(int c, void *cookie, int indent);
void script_line_start(void);
void script_line_exec(void);
diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro
index e99cbc8bf..1844924fd 100644
--- a/src/proto/fileio.pro
+++ b/src/proto/fileio.pro
@@ -18,7 +18,6 @@ void shorten_filenames(char_u **fnames, int count);
char_u *modname(char_u *fname, char_u *ext, int prepend_dot);
char_u *buf_modname(int shortname, char_u *fname, char_u *ext, int prepend_dot);
int vim_fgets(char_u *buf, int size, FILE *fp);
-int tag_fgets(char_u *buf, int size, FILE *fp);
int vim_rename(char_u *from, char_u *to);
int check_timestamps(int focus);
int buf_check_timestamp(buf_T *buf, int focus);
diff --git a/src/tag.c b/src/tag.c
index a148fbc0e..9dde6a9e2 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -1146,14 +1146,6 @@ do_tags(exarg_T *eap UNUSED)
msg_puts("\n>");
}
-/* When not using a CR for line separator, use vim_fgets() to read tag lines.
- * For the Mac use tag_fgets(). It can handle any line separator, but is much
- * slower than vim_fgets().
- */
-#ifndef USE_CR
-# define tag_fgets vim_fgets
-#endif
-
#ifdef FEAT_TAG_BINS
/*
* Compare two strings, for length "len", ignoring case the ASCII way.
@@ -1654,7 +1646,7 @@ find_tags(
/* Adjust the search file offset to the correct position */
search_info.curr_offset_used = search_info.curr_offset;
vim_fseek(fp, search_info.curr_offset, SEEK_SET);
- eof = tag_fgets(lbuf, LSIZE, fp);
+ eof = vim_fgets(lbuf, LSIZE, fp);
if (!eof && search_info.curr_offset != 0)
{
/* The explicit cast is to work around a bug in gcc 3.4.2
@@ -1666,13 +1658,13 @@ find_tags(
vim_fseek(fp, search_info.low_offset, SEEK_SET);
search_info.curr_offset = search_info.low_offset;
}
- eof = tag_fgets(lbuf, LSIZE, fp);
+ eof = vim_fgets(lbuf, LSIZE, fp);
}
/* skip empty and blank lines */
while (!eof && vim_isblankline(lbuf))
{
search_info.curr_offset = vim_ftell(fp);
- eof = tag_fgets(lbuf, LSIZE, fp);
+ eof = vim_fgets(lbuf, LSIZE, fp);
}
if (eof)
{
@@ -1698,7 +1690,7 @@ find_tags(
eof = cs_fgets(lbuf, LSIZE);
else
#endif
- eof = tag_fgets(lbuf, LSIZE, fp);
+ eof = vim_fgets(lbuf, LSIZE, fp);
} while (!eof && vim_isblankline(lbuf));
if (eof)
@@ -1763,7 +1755,7 @@ line_read_in:
{
is_etag = 1; /* in case at the start */
state = TS_LINEAR;
- if (!tag_fgets(ebuf, LSIZE, fp))
+ if (!vim_fgets(ebuf, LSIZE, fp))
{
for (p = ebuf; *p && *p != ','; p++)
;
diff --git a/src/version.c b/src/version.c
index 1451697c6..6374cba9f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -784,6 +784,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 927,
+/**/
926,
/**/
925,