aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorb-r-o-c-k <brockmammen@gmail.com>2018-05-10 22:31:55 -0500
committerb-r-o-c-k <brockmammen@gmail.com>2018-05-10 22:31:55 -0500
commite31d8ed36a78706cdaa6307cb37ea6a102c5e2f7 (patch)
tree76cca44fbc05bc640c61dda7e1b8b2116c113ed4
parent7170de19714acd5efa6979ef94de2a29e41d6173 (diff)
downloadrneovim-e31d8ed36a78706cdaa6307cb37ea6a102c5e2f7.tar.gz
rneovim-e31d8ed36a78706cdaa6307cb37ea6a102c5e2f7.tar.bz2
rneovim-e31d8ed36a78706cdaa6307cb37ea6a102c5e2f7.zip
lint
-rw-r--r--src/nvim/buffer_defs.h4
-rw-r--r--src/nvim/eval.c6
-rw-r--r--src/nvim/globals.h24
-rw-r--r--src/nvim/option.c37
4 files changed, 37 insertions, 34 deletions
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index c8c2cd732c..53edae58a5 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -237,7 +237,7 @@ typedef struct {
char_u *wo_winhl;
# define w_p_winhl w_onebuf_opt.wo_winhl // 'winhighlight'
- LastSet wo_scriptID[WV_COUNT]; /* SIDs for window-local options */
+ LastSet wo_scriptID[WV_COUNT]; // SIDs for window-local options
# define w_p_scriptID w_onebuf_opt.wo_scriptID
} winopt_T;
@@ -590,7 +590,7 @@ struct file_buffer {
*/
bool b_p_initialized; /* set when options initialized */
- LastSet b_p_scriptID[BV_COUNT]; /* SIDs for buffer-local options */
+ LastSet b_p_scriptID[BV_COUNT]; // SIDs for buffer-local options
int b_p_ai; ///< 'autoindent'
int b_p_ai_nopaste; ///< b_p_ai saved for paste mode
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index c48c22fd96..b9df155919 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -22061,8 +22061,10 @@ int store_session_globals(FILE *fd)
*/
void last_set_msg(scid_T scriptID)
{
- LastSet last_set;
- last_set.script_id = scriptID;
+ const LastSet last_set = (LastSet){
+ .script_id = scriptID,
+ .channel_id = 0,
+ };
option_last_set_msg(last_set);
}
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 1d49d6d26c..0f2b37e41b 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -390,19 +390,19 @@ EXTERN int may_garbage_collect INIT(= FALSE);
EXTERN int want_garbage_collect INIT(= FALSE);
EXTERN int garbage_collect_at_exit INIT(= FALSE);
-/* Special values for current_SID. */
-#define SID_MODELINE -1 /* when using a modeline */
-#define SID_CMDARG -2 /* for "--cmd" argument */
-#define SID_CARG -3 /* for "-c" argument */
-#define SID_ENV -4 /* for sourcing environment variable */
-#define SID_ERROR -5 /* option was reset because of an error */
-#define SID_NONE -6 /* don't set scriptID */
-#define SID_LUA -7 /* for Lua scripts/chunks */
-#define SID_API_CLIENT -8 /* for API clients */
-
-/* ID of script being sourced or was sourced to define the current function. */
+// Special values for current_SID.
+#define SID_MODELINE -1 // when using a modeline
+#define SID_CMDARG -2 // for "--cmd" argument
+#define SID_CARG -3 // for "-c" argument
+#define SID_ENV -4 // for sourcing environment variable
+#define SID_ERROR -5 // option was reset because of an error
+#define SID_NONE -6 // don't set scriptID
+#define SID_LUA -7 // for Lua scripts/chunks
+#define SID_API_CLIENT -8 // for API clients
+
+// ID of script being sourced or was sourced to define the current function.
EXTERN scid_T current_SID INIT(= 0);
-/* ID of the current channel making a client API call */
+// ID of the current channel making a client API call
EXTERN uint64_t current_channel_id INIT(= 0);
EXTERN bool did_source_packages INIT(= false);
diff --git a/src/nvim/option.c b/src/nvim/option.c
index a2120b9ab4..96b2413c8f 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -187,16 +187,16 @@ static long p_tw_nopaste;
static long p_wm_nopaste;
typedef struct vimoption {
- char *fullname; /* full option name */
- char *shortname; /* permissible abbreviation */
- uint32_t flags; /* see below */
- char_u *var; /* global option: pointer to variable;
- * window-local option: VAR_WIN;
- * buffer-local option: global value */
- idopt_T indir; /* global option: PV_NONE;
- * local option: indirect option index */
- char_u *def_val[2]; /* default values for variable (vi and vim) */
- LastSet last_set; /* script in which the option was last set */
+ char *fullname; // full option name
+ char *shortname; // permissible abbreviation
+ uint32_t flags; // see below
+ char_u *var; // global option: pointer to variable;
+ // window-local option: VAR_WIN;
+ // buffer-local option: global value
+ idopt_T indir; // global option: PV_NONE;
+ // local option: indirect option index
+ char_u *def_val[2]; // default values for variable (vi and vim)
+ LastSet last_set; // script in which the option was last set
# define SCRIPTID_INIT , 0
} vimoption_T;
@@ -1366,15 +1366,16 @@ do_set (
if (opt_idx >= 0) {
showoneopt(&options[opt_idx], opt_flags);
if (p_verbose > 0) {
- /* Mention where the option was last set. */
- if (varp == options[opt_idx].var)
+ // Mention where the option was last set.
+ if (varp == options[opt_idx].var) {
option_last_set_msg(options[opt_idx].last_set);
- else if ((int)options[opt_idx].indir & PV_WIN)
+ } else if ((int)options[opt_idx].indir & PV_WIN) {
option_last_set_msg(curwin->w_p_scriptID[
- (int)options[opt_idx].indir & PV_MASK]);
- else if ((int)options[opt_idx].indir & PV_BUF)
+ (int)options[opt_idx].indir & PV_MASK]);
+ } else if ((int)options[opt_idx].indir & PV_BUF) {
option_last_set_msg(curbuf->b_p_scriptID[
- (int)options[opt_idx].indir & PV_MASK]);
+ (int)options[opt_idx].indir & PV_MASK]);
+ }
}
} else {
errmsg = (char_u *)N_("E846: Key code not set");
@@ -3665,8 +3666,8 @@ static void set_option_scriptID_idx(int opt_idx, int opt_flags, int id)
int indir = (int)options[opt_idx].indir;
const LastSet last_set = { id, current_channel_id };
- /* Remember where the option was set. For local options need to do that
- * in the buffer or window structure. */
+ // Remember where the option was set. For local options need to do that
+ // in the buffer or window structure.
if (both || (opt_flags & OPT_GLOBAL) || (indir & (PV_BUF|PV_WIN)) == 0) {
options[opt_idx].last_set = last_set;
}