refactor(options): remove fileformat macros

This commit is contained in:
Famiu Haque 2024-11-03 16:36:26 +06:00
parent 079e5f4f9b
commit cbc9a03f58
No known key found for this signature in database
5 changed files with 14 additions and 25 deletions

View File

@ -801,7 +801,7 @@ static int diff_write(buf_T *buf, diffin_T *din)
// Always use 'fileformat' set to "unix".
char *save_ff = buf->b_p_ff;
buf->b_p_ff = xstrdup(FF_UNIX);
buf->b_p_ff = xstrdup("unix");
const bool save_cmod_flags = cmdmod.cmod_flags;
// Writing the buffer is an implementation detail of performing the diff,
// so it shouldn't update the '[ and '] marks.

View File

@ -5105,13 +5105,13 @@ void buf_copy_options(buf_T *buf, int flags)
buf->b_p_fenc = xstrdup(p_fenc);
switch (*p_ffs) {
case 'm':
buf->b_p_ff = xstrdup(FF_MAC);
buf->b_p_ff = xstrdup("mac");
break;
case 'd':
buf->b_p_ff = xstrdup(FF_DOS);
buf->b_p_ff = xstrdup("dos");
break;
case 'u':
buf->b_p_ff = xstrdup(FF_UNIX);
buf->b_p_ff = xstrdup("unix");
break;
default:
buf->b_p_ff = xstrdup(p_ff);
@ -6240,13 +6240,13 @@ void set_fileformat(int eol_style, int opt_flags)
switch (eol_style) {
case EOL_UNIX:
p = FF_UNIX;
p = "unix";
break;
case EOL_MAC:
p = FF_MAC;
p = "mac";
break;
case EOL_DOS:
p = FF_DOS;
p = "dos";
break;
}

View File

@ -31,21 +31,6 @@
#define DFLT_GREPFORMAT "%f:%l:%m,%f:%l%m,%f %l%m"
// default values for b_p_ff 'fileformat' and p_ffs 'fileformats'
#define FF_DOS "dos"
#define FF_MAC "mac"
#define FF_UNIX "unix"
#ifdef USE_CRNL
# define DFLT_FF "dos"
# define DFLT_FFS_VIM "dos,unix"
# define DFLT_FFS_VI "dos,unix" // also autodetect in compatible mode
#else
# define DFLT_FF "unix"
# define DFLT_FFS_VIM "unix,dos"
# define DFLT_FFS_VI ""
#endif
// Possible values for 'encoding'
#define ENC_UCSBOM "ucs-bom" // check for BOM at start of file

View File

@ -2684,7 +2684,9 @@ return {
abbreviation = 'ff',
cb = 'did_set_fileformat',
defaults = {
if_true = macros('DFLT_FF', 'string'),
condition = 'USE_CRNL',
if_true = 'dos',
if_false = 'unix',
doc = 'Windows: "dos", Unix: "unix"',
},
desc = [=[
@ -2717,7 +2719,9 @@ return {
abbreviation = 'ffs',
cb = 'did_set_fileformats',
defaults = {
if_true = macros('DFLT_FFS_VIM', 'string'),
condition = 'USE_CRNL',
if_true = 'dos,unix',
if_false = 'unix,dos',
doc = 'Windows: "dos,unix", Unix: "unix,dos"',
},
deny_duplicates = true,

View File

@ -84,7 +84,7 @@ static char *(p_dip_values[]) = { "filler", "context:", "iblank", "icase",
"indent-heuristic", "linematch:", "algorithm:", NULL };
static char *(p_dip_algorithm_values[]) = { "myers", "minimal", "patience", "histogram", NULL };
static char *(p_nf_values[]) = { "bin", "octal", "hex", "alpha", "unsigned", "blank", NULL };
static char *(p_ff_values[]) = { FF_UNIX, FF_DOS, FF_MAC, NULL };
static char *(p_ff_values[]) = { "unix", "dos", "mac", NULL };
static char *(p_cb_values[]) = { "unnamed", "unnamedplus", NULL };
static char *(p_cmp_values[]) = { "internal", "keepascii", NULL };
// Note: Keep this in sync with fill_culopt_flags()