mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
refactor: follow style guide
This commit is contained in:
@ -1316,9 +1316,3 @@ struct window_S {
|
||||
// Size of the w_statuscol_click_defs array
|
||||
size_t w_statuscol_click_defs_size;
|
||||
};
|
||||
|
||||
/// Macros defined in Vim, but not in Neovim
|
||||
// uncrustify:off
|
||||
#define CHANGEDTICK(buf) \
|
||||
(=== Include buffer.h & use buf_(get|set|inc) _changedtick ===)
|
||||
// uncrustify:on
|
||||
|
@ -105,7 +105,6 @@ static int get_function_args(char **argp, char endchar, garray_T *newargs, int *
|
||||
bool mustend = false;
|
||||
char *arg = *argp;
|
||||
char *p = arg;
|
||||
uint8_t c;
|
||||
|
||||
if (newargs != NULL) {
|
||||
ga_init(newargs, (int)sizeof(char *), 3);
|
||||
@ -142,7 +141,7 @@ static int get_function_args(char **argp, char endchar, garray_T *newargs, int *
|
||||
}
|
||||
if (newargs != NULL) {
|
||||
ga_grow(newargs, 1);
|
||||
c = (uint8_t)(*p);
|
||||
uint8_t c = (uint8_t)(*p);
|
||||
*p = NUL;
|
||||
arg = xstrdup(arg);
|
||||
|
||||
@ -173,7 +172,7 @@ static int get_function_args(char **argp, char endchar, garray_T *newargs, int *
|
||||
while (p > expr && ascii_iswhite(p[-1])) {
|
||||
p--;
|
||||
}
|
||||
c = (uint8_t)(*p);
|
||||
uint8_t c = (uint8_t)(*p);
|
||||
*p = NUL;
|
||||
expr = xstrdup(expr);
|
||||
((char **)(default_args->ga_data))[default_args->ga_len] = expr;
|
||||
@ -325,7 +324,6 @@ int get_lambda_tv(char **arg, typval_T *rettv, evalarg_T *evalarg)
|
||||
|
||||
if (evaluate) {
|
||||
int flags = 0;
|
||||
char *p;
|
||||
garray_T newlines;
|
||||
|
||||
char *name = get_lambda_name();
|
||||
@ -338,7 +336,7 @@ int get_lambda_tv(char **arg, typval_T *rettv, evalarg_T *evalarg)
|
||||
|
||||
// Add "return " before the expression.
|
||||
size_t len = (size_t)(7 + end - start + 1);
|
||||
p = xmalloc(len);
|
||||
char *p = xmalloc(len);
|
||||
((char **)(newlines.ga_data))[newlines.ga_len++] = p;
|
||||
STRCPY(p, "return ");
|
||||
xstrlcpy(p + 7, start, (size_t)(end - start) + 1);
|
||||
@ -918,7 +916,6 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
||||
FUNC_ATTR_NONNULL_ARG(1, 3, 4)
|
||||
{
|
||||
bool using_sandbox = false;
|
||||
int save_did_emsg;
|
||||
static int depth = 0;
|
||||
dictitem_T *v;
|
||||
int fixvar_idx = 0; // index in fc_fixvar[]
|
||||
@ -1167,7 +1164,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
||||
|
||||
const sctx_T save_current_sctx = current_sctx;
|
||||
current_sctx = fp->uf_script_ctx;
|
||||
save_did_emsg = did_emsg;
|
||||
int save_did_emsg = did_emsg;
|
||||
did_emsg = false;
|
||||
|
||||
if (default_arg_err && (fp->uf_flags & FC_ABORT)) {
|
||||
|
@ -221,10 +221,6 @@ int get_number(int colon, int *mouse_used)
|
||||
/// the line number.
|
||||
int prompt_for_number(int *mouse_used)
|
||||
{
|
||||
int i;
|
||||
int save_cmdline_row;
|
||||
int save_State;
|
||||
|
||||
// When using ":silent" assume that <CR> was entered.
|
||||
if (mouse_used != NULL) {
|
||||
msg_puts(_("Type number and <Enter> or click with the mouse "
|
||||
@ -235,14 +231,14 @@ int prompt_for_number(int *mouse_used)
|
||||
|
||||
// Set the state such that text can be selected/copied/pasted and we still
|
||||
// get mouse events.
|
||||
save_cmdline_row = cmdline_row;
|
||||
int save_cmdline_row = cmdline_row;
|
||||
cmdline_row = 0;
|
||||
save_State = State;
|
||||
int save_State = State;
|
||||
State = MODE_ASKMORE; // prevents a screen update when using a timer
|
||||
// May show different mouse shape.
|
||||
setmouse();
|
||||
|
||||
i = get_number(true, mouse_used);
|
||||
int i = get_number(true, mouse_used);
|
||||
if (KeyTyped) {
|
||||
// don't call wait_return() now
|
||||
if (msg_row > 0) {
|
||||
|
@ -875,9 +875,7 @@ char *replace_termcodes(const char *const from, const size_t from_len, char **co
|
||||
const char *const cpo_val)
|
||||
FUNC_ATTR_NONNULL_ARG(1, 3, 7)
|
||||
{
|
||||
char key;
|
||||
size_t dlen = 0;
|
||||
const char *src;
|
||||
const char *const end = from + from_len - 1;
|
||||
|
||||
// backslash is a special character
|
||||
@ -891,7 +889,7 @@ char *replace_termcodes(const char *const from, const size_t from_len, char **co
|
||||
const size_t buf_len = allocated ? from_len * 6 + 1 : 128;
|
||||
char *result = allocated ? xmalloc(buf_len) : *bufp; // buffer for resulting string
|
||||
|
||||
src = from;
|
||||
const char *src = from;
|
||||
|
||||
// Copy each byte from *from to result[dlen]
|
||||
while (src <= end) {
|
||||
@ -966,7 +964,7 @@ char *replace_termcodes(const char *const from, const size_t from_len, char **co
|
||||
// For "from" side the CTRL-V at the end is included, for the "to"
|
||||
// part it is removed.
|
||||
// If 'cpoptions' does not contain 'B', also accept a backslash.
|
||||
key = *src;
|
||||
char key = *src;
|
||||
if (key == Ctrl_V || (do_backslash && key == '\\')) {
|
||||
src++; // skip CTRL-V or backslash
|
||||
if (src > end) {
|
||||
|
@ -23,9 +23,9 @@
|
||||
|
||||
#include "nvim/func_attr.h"
|
||||
|
||||
typedef struct _queue {
|
||||
struct _queue *next;
|
||||
struct _queue *prev;
|
||||
typedef struct queue {
|
||||
struct queue *next;
|
||||
struct queue *prev;
|
||||
} QUEUE;
|
||||
|
||||
// Public macros.
|
||||
|
@ -450,10 +450,8 @@ static void next_search_hl(win_T *win, match_T *search_hl, match_T *shl, linenr_
|
||||
} else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL
|
||||
|| (shl->rm.endpos[0].lnum == 0
|
||||
&& shl->rm.endpos[0].col <= shl->rm.startpos[0].col)) {
|
||||
char *ml;
|
||||
|
||||
matchcol = shl->rm.startpos[0].col;
|
||||
ml = ml_get_buf(shl->buf, lnum) + matchcol;
|
||||
char *ml = ml_get_buf(shl->buf, lnum) + matchcol;
|
||||
if (*ml == NUL) {
|
||||
matchcol++;
|
||||
shl->lnum = 0;
|
||||
|
@ -215,7 +215,6 @@ int get_extra_op_char(int optype)
|
||||
/// handle a shift operation
|
||||
void op_shift(oparg_T *oap, int curs_top, int amount)
|
||||
{
|
||||
int i;
|
||||
int block_col = 0;
|
||||
|
||||
if (u_save((linenr_T)(oap->start.lnum - 1),
|
||||
@ -227,7 +226,7 @@ void op_shift(oparg_T *oap, int curs_top, int amount)
|
||||
block_col = curwin->w_cursor.col;
|
||||
}
|
||||
|
||||
for (i = oap->line_count - 1; i >= 0; i--) {
|
||||
for (int i = oap->line_count - 1; i >= 0; i--) {
|
||||
int first_char = (uint8_t)(*get_cursor_line_ptr());
|
||||
if (first_char == NUL) { // empty line
|
||||
curwin->w_cursor.col = 0;
|
||||
|
Reference in New Issue
Block a user