patch 9.1.2083: style: wrong indentation of nested ifdefs

Problem:  style: wrong indentation of nested ifdefs
Solution: Fix indentation
          (Hirohito Higashi)

related: #19165

Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Hirohito Higashi
2026-01-13 21:14:33 +00:00
committed by Christian Brabandt
parent 92ff4d615d
commit 9fd2cae482
117 changed files with 4143 additions and 4142 deletions
+86 -86
View File
@@ -25,46 +25,46 @@ static int diff_busy = FALSE; // using diff structs, don't change them
static int diff_need_update = FALSE; // ex_diffupdate needs to be called
// flags obtained from the 'diffopt' option
#define DIFF_FILLER 0x001 // display filler lines
#define DIFF_IBLANK 0x002 // ignore empty lines
#define DIFF_ICASE 0x004 // ignore case
#define DIFF_IWHITE 0x008 // ignore change in white space
#define DIFF_IWHITEALL 0x010 // ignore all white space changes
#define DIFF_IWHITEEOL 0x020 // ignore change in white space at EOL
#define DIFF_HORIZONTAL 0x040 // horizontal splits
#define DIFF_VERTICAL 0x080 // vertical splits
#define DIFF_HIDDEN_OFF 0x100 // diffoff when hidden
#define DIFF_INTERNAL 0x200 // use internal xdiff algorithm
#define DIFF_CLOSE_OFF 0x400 // diffoff when closing window
#define DIFF_FOLLOWWRAP 0x800 // follow the wrap option
#define DIFF_LINEMATCH 0x1000 // match most similar lines within diff
#define DIFF_INLINE_NONE 0x2000 // no inline highlight
#define DIFF_INLINE_SIMPLE 0x4000 // inline highlight with simple algorithm
#define DIFF_INLINE_CHAR 0x8000 // inline highlight with character diff
#define DIFF_INLINE_WORD 0x10000 // inline highlight with word diff
#define DIFF_ANCHOR 0x20000 // use 'diffanchors' to anchor the diff
#define ALL_WHITE_DIFF (DIFF_IWHITE | DIFF_IWHITEALL | DIFF_IWHITEEOL)
#define ALL_INLINE (DIFF_INLINE_NONE | DIFF_INLINE_SIMPLE | DIFF_INLINE_CHAR | DIFF_INLINE_WORD)
#define ALL_INLINE_DIFF (DIFF_INLINE_CHAR | DIFF_INLINE_WORD)
# define DIFF_FILLER 0x001 // display filler lines
# define DIFF_IBLANK 0x002 // ignore empty lines
# define DIFF_ICASE 0x004 // ignore case
# define DIFF_IWHITE 0x008 // ignore change in white space
# define DIFF_IWHITEALL 0x010 // ignore all white space changes
# define DIFF_IWHITEEOL 0x020 // ignore change in white space at EOL
# define DIFF_HORIZONTAL 0x040 // horizontal splits
# define DIFF_VERTICAL 0x080 // vertical splits
# define DIFF_HIDDEN_OFF 0x100 // diffoff when hidden
# define DIFF_INTERNAL 0x200 // use internal xdiff algorithm
# define DIFF_CLOSE_OFF 0x400 // diffoff when closing window
# define DIFF_FOLLOWWRAP 0x800 // follow the wrap option
# define DIFF_LINEMATCH 0x1000 // match most similar lines within diff
# define DIFF_INLINE_NONE 0x2000 // no inline highlight
# define DIFF_INLINE_SIMPLE 0x4000 // inline highlight with simple algorithm
# define DIFF_INLINE_CHAR 0x8000 // inline highlight with character diff
# define DIFF_INLINE_WORD 0x10000 // inline highlight with word diff
# define DIFF_ANCHOR 0x20000 // use 'diffanchors' to anchor the diff
# define ALL_WHITE_DIFF (DIFF_IWHITE | DIFF_IWHITEALL | DIFF_IWHITEEOL)
# define ALL_INLINE (DIFF_INLINE_NONE | DIFF_INLINE_SIMPLE | DIFF_INLINE_CHAR | DIFF_INLINE_WORD)
# define ALL_INLINE_DIFF (DIFF_INLINE_CHAR | DIFF_INLINE_WORD)
static int diff_flags = DIFF_INTERNAL | DIFF_FILLER | DIFF_CLOSE_OFF | DIFF_INLINE_CHAR;
static long diff_algorithm = XDF_INDENT_HEURISTIC;
#define LBUFLEN 50 // length of line in diff file
# define LBUFLEN 50 // length of line in diff file
// Max file size xdiff is equipped to deal with. The value (1GB - 1MB) comes
// from Git's implementation.
#define MAX_XDIFF_SIZE (1024L * 1024 * 1023)
# define MAX_XDIFF_SIZE (1024L * 1024 * 1023)
static int diff_a_works = MAYBE; // TRUE when "diff -a" works, FALSE when it
// doesn't work, MAYBE when not checked yet
#if defined(MSWIN)
# if defined(MSWIN)
static int diff_bin_works = MAYBE; // TRUE when "diff --binary" works, FALSE
// when it doesn't work, MAYBE when not
// checked yet
#endif
# endif
#define MAX_DIFF_ANCHORS 20
# define MAX_DIFF_ANCHORS 20
// used for diff input
typedef struct {
@@ -110,9 +110,9 @@ static int check_external_diff(diffio_T *diffio);
static int diff_file(diffio_T *diffio);
static int diff_equal_entry(diff_T *dp, int idx1, int idx2);
static int diff_cmp(char_u *s1, char_u *s2);
#ifdef FEAT_FOLDING
# ifdef FEAT_FOLDING
static void diff_fold_update(diff_T *dp, int skip_idx);
#endif
# endif
static void diff_read(int idx_orig, int idx_new, diffio_T *dio);
static void diff_copy_entry(diff_T *dprev, diff_T *dp, int idx_orig, int idx_new);
static diff_T *diff_alloc_new(tabpage_T *tp, diff_T *dprev, diff_T *dp);
@@ -122,7 +122,7 @@ static int xdiff_out_indices(long start_a, long count_a, long start_b, long coun
static int xdiff_out_unified(void *priv, mmbuffer_t *mb, int nbuf);
static int parse_diffanchors(int check_only, buf_T *buf, linenr_T *anchors, int *num_anchors);
#define FOR_ALL_DIFFBLOCKS_IN_TAB(tp, dp) \
# define FOR_ALL_DIFFBLOCKS_IN_TAB(tp, dp) \
for ((dp) = (tp)->tp_first_diff; (dp) != NULL; (dp) = (dp)->df_next)
static void
@@ -734,10 +734,10 @@ diff_redraw(
redraw_win_later(wp, UPD_SOME_VALID);
if (wp != curwin)
wp_other = wp;
#ifdef FEAT_FOLDING
# ifdef FEAT_FOLDING
if (dofold && foldmethodIsDiff(wp))
foldUpdateAll(wp);
#endif
# endif
// A change may have made filler lines invalid, need to take care of
// that for other windows.
n = diff_check_fill(wp, wp->w_topline);
@@ -1102,9 +1102,9 @@ theend:
diff_internal(void)
{
return (diff_flags & DIFF_INTERNAL) != 0
#ifdef FEAT_EVAL
# ifdef FEAT_EVAL
&& *p_dex == NUL
#endif
# endif
;
}
@@ -1246,13 +1246,13 @@ check_external_diff(diffio_T *diffio)
mch_remove(diffio->dio_orig.din_fname);
}
#ifdef FEAT_EVAL
# ifdef FEAT_EVAL
// When using 'diffexpr' break here.
if (*p_dex != NUL)
break;
#endif
# endif
#if defined(MSWIN)
# if defined(MSWIN)
// If the "-a" argument works, also check if "--binary" works.
if (ok && diff_a_works == MAYBE && diff_bin_works == MAYBE)
{
@@ -1266,7 +1266,7 @@ check_external_diff(diffio_T *diffio)
diff_bin_works = FALSE;
ok = TRUE;
}
#endif
# endif
// If we checked if "-a" works already, break here.
if (diff_a_works != MAYBE)
@@ -1283,9 +1283,9 @@ check_external_diff(diffio_T *diffio)
emsg(_(e_cannot_read_or_write_temp_files));
emsg(_(e_cannot_create_diffs));
diff_a_works = MAYBE;
#if defined(MSWIN)
# if defined(MSWIN)
diff_bin_works = MAYBE;
#endif
# endif
return FAIL;
}
return OK;
@@ -1351,7 +1351,7 @@ diff_file(diffio_T *dio)
char_u *tmp_new = dio->dio_new.din_fname;
char_u *tmp_diff = dio->dio_diff.dout_fname;
#ifdef FEAT_EVAL
# ifdef FEAT_EVAL
if (*p_dex != NUL)
{
// Use 'diffexpr' to generate the diff file.
@@ -1359,7 +1359,7 @@ diff_file(diffio_T *dio)
return OK;
}
else
#endif
# endif
// Use xdiff for generating the diff.
if (dio->dio_internal)
return diff_file_internal(dio);
@@ -1379,11 +1379,11 @@ diff_file(diffio_T *dio)
// non-zero when differences have been found.
vim_snprintf((char *)cmd, len, "diff %s%s%s%s%s%s%s%s %s",
diff_a_works == FALSE ? "" : "-a ",
#if defined(MSWIN)
# if defined(MSWIN)
diff_bin_works == TRUE ? "--binary " : "",
#else
# else
"",
#endif
# endif
(diff_flags & DIFF_IWHITE) ? "-b " : "",
(diff_flags & DIFF_IWHITEALL) ? "-w " : "",
(diff_flags & DIFF_IWHITEEOL) ? "-Z " : "",
@@ -1412,18 +1412,18 @@ ex_diffpatch(exarg_T *eap)
size_t buflen;
win_T *old_curwin = curwin;
char_u *newname = NULL; // name of patched file buffer
#ifdef UNIX
# ifdef UNIX
char_u dirbuf[MAXPATHL];
char_u *fullname = NULL;
#endif
#ifdef FEAT_BROWSE
# endif
# ifdef FEAT_BROWSE
char_u *browseFile = NULL;
int save_cmod_flags = cmdmod.cmod_flags;
#endif
# endif
stat_T st;
char_u *esc_name = NULL;
#ifdef FEAT_BROWSE
# ifdef FEAT_BROWSE
if (cmdmod.cmod_flags & CMOD_BROWSE)
{
browseFile = do_browse(0, (char_u *)_("Patch file"),
@@ -1434,7 +1434,7 @@ ex_diffpatch(exarg_T *eap)
eap->arg = browseFile;
cmdmod.cmod_flags &= ~CMOD_BROWSE; // don't let do_ecmd() browse again
}
#endif
# endif
// We need two temp file names.
tmp_orig = vim_tempname('o', FALSE);
@@ -1448,10 +1448,10 @@ ex_diffpatch(exarg_T *eap)
NULL, FALSE, FALSE, FALSE, TRUE) == FAIL)
goto theend;
#ifdef UNIX
# ifdef UNIX
// Get the absolute path of the patchfile, changing directory below.
fullname = FullName_save(eap->arg, FALSE);
#endif
# endif
esc_name = vim_strsave_shellescape(
# ifdef UNIX
fullname != NULL ? fullname :
@@ -1464,7 +1464,7 @@ ex_diffpatch(exarg_T *eap)
if (buf == NULL)
goto theend;
#ifdef UNIX
# ifdef UNIX
// Temporarily chdir to /tmp, to avoid patching files in the current
// directory when the patch file contains more than one patch. When we
// have our own temp dir use that instead, it will be cleaned up when we
@@ -1474,26 +1474,26 @@ ex_diffpatch(exarg_T *eap)
dirbuf[0] = NUL;
else
{
# ifdef TEMPDIRNAMES
# ifdef TEMPDIRNAMES
if (vim_tempdir != NULL)
vim_ignored = mch_chdir((char *)vim_tempdir);
else
# endif
# endif
vim_ignored = mch_chdir("/tmp");
shorten_fnames(TRUE);
}
#endif
# endif
#ifdef FEAT_EVAL
# ifdef FEAT_EVAL
if (*p_pex != NUL)
// Use 'patchexpr' to generate the new file.
eval_patch(tmp_orig,
# ifdef UNIX
# ifdef UNIX
fullname != NULL ? fullname :
# endif
# endif
eap->arg, tmp_new);
else
#endif
# endif
{
if (check_restricted())
goto theend;
@@ -1507,14 +1507,14 @@ ex_diffpatch(exarg_T *eap)
unblock_autocmds();
}
#ifdef UNIX
# ifdef UNIX
if (dirbuf[0] != NUL)
{
if (mch_chdir((char *)dirbuf) != 0)
emsg(_(e_cannot_go_back_to_previous_directory));
shorten_fnames(TRUE);
}
#endif
# endif
// patch probably has written over the screen
redraw_later(UPD_CLEAR);
@@ -1540,9 +1540,9 @@ ex_diffpatch(exarg_T *eap)
STRCAT(newname, ".new");
}
#ifdef FEAT_GUI
# ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif
# endif
// don't use a new tab page, each tab page has its own diffs
cmdmod.cmod_tab = 0;
@@ -1584,14 +1584,14 @@ theend:
vim_free(tmp_new);
vim_free(newname);
vim_free(buf);
#ifdef UNIX
# ifdef UNIX
vim_free(fullname);
#endif
# endif
vim_free(esc_name);
#ifdef FEAT_BROWSE
# ifdef FEAT_BROWSE
vim_free(browseFile);
cmdmod.cmod_flags = save_cmod_flags;
#endif
# endif
}
/*
@@ -1604,9 +1604,9 @@ ex_diffsplit(exarg_T *eap)
bufref_T old_curbuf;
set_bufref(&old_curbuf, curbuf);
#ifdef FEAT_GUI
# ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif
# endif
// Need to compute w_fraction when no redraw happened yet.
validate_cursor();
set_fraction(curwin);
@@ -1764,7 +1764,7 @@ ex_diffoff(exarg_T *eap)
wp->w_leftcol = 0;
}
}
#ifdef FEAT_FOLDING
# ifdef FEAT_FOLDING
free_string_option(wp->w_p_fdm);
wp->w_p_fdm = vim_strsave(
*wp->w_p_fdm_save ? wp->w_p_fdm_save : (char_u*)"manual");
@@ -1781,7 +1781,7 @@ ex_diffoff(exarg_T *eap)
: wp->w_p_fen_save;
foldUpdateAll(wp);
#endif
# endif
}
// remove filler lines
wp->w_topfill = 0;
@@ -2456,11 +2456,11 @@ diff_check_with_linestatus(win_T *wp, linenr_T lnum, int *linestatus)
if (idx == DB_COUNT)
return 0; // no diffs for buffer "buf"
#ifdef FEAT_FOLDING
# ifdef FEAT_FOLDING
// A closed fold never has filler lines.
if (hasFoldingWin(wp, lnum, NULL, NULL, TRUE, NULL))
return 0;
#endif
# endif
// search for a change that includes "lnum" in the list of diffblocks.
FOR_ALL_DIFFBLOCKS_IN_TAB(curtab, dp)
@@ -2753,10 +2753,10 @@ diff_set_topline(win_T *fromwin, win_T *towin)
changed_line_abv_curs_win(towin);
check_topfill(towin, FALSE);
#ifdef FEAT_FOLDING
# ifdef FEAT_FOLDING
(void)hasFoldingWin(towin, towin->w_topline, &towin->w_topline,
NULL, TRUE, NULL);
#endif
# endif
}
/*
@@ -3832,7 +3832,7 @@ diff_find_change(
return added;
}
#if defined(FEAT_FOLDING)
# if defined(FEAT_FOLDING)
/*
* Return TRUE if line "lnum" is not close to a diff block, this line should
* be in a fold.
@@ -3880,7 +3880,7 @@ diff_infold(win_T *wp, linenr_T lnum)
}
return TRUE;
}
#endif
# endif
/*
* "dp" and "do" commands.
@@ -3891,13 +3891,13 @@ nv_diffgetput(int put, long count)
exarg_T ea;
char_u buf[30];
#ifdef FEAT_JOB_CHANNEL
# ifdef FEAT_JOB_CHANNEL
if (bt_prompt(curbuf))
{
vim_beep(BO_OPER);
return;
}
#endif
# endif
if (count == 0)
ea.arg = (char_u *)"";
else
@@ -4227,9 +4227,9 @@ ex_diffgetput(exarg_T *eap)
if (dfree != NULL)
{
// Diff is deleted, update folds in other windows.
#ifdef FEAT_FOLDING
# ifdef FEAT_FOLDING
diff_fold_update(dfree, idx_to);
#endif
# endif
clear_diffblock(dfree);
}
@@ -4277,7 +4277,7 @@ theend:
check_cursor();
changed_line_abv_curs();
#ifdef FEAT_FOLDING
# ifdef FEAT_FOLDING
// If all diffs are gone, update folds in all diff windows.
if (curtab->tp_first_diff == NULL)
{
@@ -4287,7 +4287,7 @@ theend:
if (wp->w_p_diff && wp->w_p_fdm[0] == 'd' && wp->w_p_fen)
foldUpdateAll(wp);
}
#endif
# endif
if (diff_need_update)
// redraw already done by ex_diffupdate()
@@ -4300,7 +4300,7 @@ theend:
}
}
#ifdef FEAT_FOLDING
# ifdef FEAT_FOLDING
/*
* Update folds for all diff buffers for entry "dp".
* Skip buffer with index "skip_idx".
@@ -4318,7 +4318,7 @@ diff_fold_update(diff_T *dp, int skip_idx)
foldUpdate(wp, dp->df_lnum[i],
dp->df_lnum[i] + dp->df_count[i]);
}
#endif
# endif
/*
* Return TRUE if buffer "buf" is in diff-mode.