mirror of
https://github.com/neovim/neovim.git
synced 2025-09-10 05:18:16 +00:00
*: Fix lint errors found in new code in previously ignored files
This commit is contained in:
@@ -1995,7 +1995,7 @@ buflist_nr2name (
|
|||||||
///
|
///
|
||||||
/// @param[in,out] buf Buffer for which line and column are set.
|
/// @param[in,out] buf Buffer for which line and column are set.
|
||||||
/// @param[in,out] win Window for which line and column are set.
|
/// @param[in,out] win Window for which line and column are set.
|
||||||
/// @param[in] lnum Line number to be set. If it is zero then only
|
/// @param[in] lnum Line number to be set. If it is zero then only
|
||||||
/// options are touched.
|
/// options are touched.
|
||||||
/// @param[in] col Column number to be set.
|
/// @param[in] col Column number to be set.
|
||||||
/// @param[in] copy_options If true save the local window option values.
|
/// @param[in] copy_options If true save the local window option values.
|
||||||
|
@@ -512,10 +512,10 @@ struct file_buffer {
|
|||||||
visualinfo_T b_visual;
|
visualinfo_T b_visual;
|
||||||
int b_visual_mode_eval; /* b_visual.vi_mode for visualmode() */
|
int b_visual_mode_eval; /* b_visual.vi_mode for visualmode() */
|
||||||
|
|
||||||
fmark_T b_last_cursor; /* cursor position when last unloading this
|
fmark_T b_last_cursor; // cursor position when last unloading this
|
||||||
buffer */
|
// buffer
|
||||||
fmark_T b_last_insert; /* where Insert mode was left */
|
fmark_T b_last_insert; // where Insert mode was left
|
||||||
fmark_T b_last_change; /* position of last change: '. mark */
|
fmark_T b_last_change; // position of last change: '. mark
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the changelist contains old change positions
|
* the changelist contains old change positions
|
||||||
|
@@ -5340,7 +5340,7 @@ static int list_concat(list_T *l1, list_T *l2, typval_T *tv)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
||||||
/* make a copy of the first list. */
|
/* make a copy of the first list. */
|
||||||
l = list_copy(NULL, l1, FALSE, 0);
|
l = list_copy(NULL, l1, false, 0);
|
||||||
if (l == NULL)
|
if (l == NULL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
tv->v_type = VAR_LIST;
|
tv->v_type = VAR_LIST;
|
||||||
@@ -5358,7 +5358,7 @@ static int list_concat(list_T *l1, list_T *l2, typval_T *tv)
|
|||||||
/// @param[in] deep If false, then shallow copy will be done.
|
/// @param[in] deep If false, then shallow copy will be done.
|
||||||
/// @param[in] copyID See var_item_copy().
|
/// @param[in] copyID See var_item_copy().
|
||||||
///
|
///
|
||||||
/// @return Copied list. May be NULL in case original list is NULL or some
|
/// @return Copied list. May be NULL in case original list is NULL or some
|
||||||
/// failure happens. The refcount of the new list is set to 1.
|
/// failure happens. The refcount of the new list is set to 1.
|
||||||
static list_T *list_copy(const vimconv_T *const conv,
|
static list_T *list_copy(const vimconv_T *const conv,
|
||||||
list_T *const orig,
|
list_T *const orig,
|
||||||
@@ -6089,8 +6089,8 @@ void dictitem_free(dictitem_T *item)
|
|||||||
/// @param[in] deep If false, then shallow copy will be done.
|
/// @param[in] deep If false, then shallow copy will be done.
|
||||||
/// @param[in] copyID See var_item_copy().
|
/// @param[in] copyID See var_item_copy().
|
||||||
///
|
///
|
||||||
/// @return Copied dictionary. May be NULL in case original dictionary is NULL
|
/// @return Copied dictionary. May be NULL in case original dictionary is NULL
|
||||||
/// or some failure happens. The refcount of the new dictionary is set
|
/// or some failure happens. The refcount of the new dictionary is set
|
||||||
/// to 1.
|
/// to 1.
|
||||||
static dict_T *dict_copy(const vimconv_T *const conv,
|
static dict_T *dict_copy(const vimconv_T *const conv,
|
||||||
dict_T *const orig,
|
dict_T *const orig,
|
||||||
@@ -18591,21 +18591,21 @@ void copy_tv(typval_T *from, typval_T *to)
|
|||||||
/// @param[in] conv If not NULL, convert all copied strings.
|
/// @param[in] conv If not NULL, convert all copied strings.
|
||||||
/// @param[in] from Value to copy.
|
/// @param[in] from Value to copy.
|
||||||
/// @param[out] to Location where to copy to.
|
/// @param[out] to Location where to copy to.
|
||||||
/// @param[in] deep If true, use copy the container and all of the contained
|
/// @param[in] deep If true, use copy the container and all of the contained
|
||||||
/// containers (nested).
|
/// containers (nested).
|
||||||
/// @param[in] copyID If non-zero then when container is referenced more then
|
/// @param[in] copyID If non-zero then when container is referenced more then
|
||||||
/// once then copy of it that was already done is used. E.g.
|
/// once then copy of it that was already done is used. E.g.
|
||||||
/// when copying list `list = [list2, list2]` (`list[0] is
|
/// when copying list `list = [list2, list2]` (`list[0] is
|
||||||
/// list[1]`) var_item_copy with zero copyID will emit
|
/// list[1]`) var_item_copy with zero copyID will emit
|
||||||
/// a copy with (`copy[0] isnot copy[1]`), with non-zero it
|
/// a copy with (`copy[0] isnot copy[1]`), with non-zero it
|
||||||
/// will emit a copy with (`copy[0] is copy[1]`) like in the
|
/// will emit a copy with (`copy[0] is copy[1]`) like in the
|
||||||
/// original list. Not use when deep is false.
|
/// original list. Not use when deep is false.
|
||||||
int var_item_copy(const vimconv_T *const conv,
|
int var_item_copy(const vimconv_T *const conv,
|
||||||
typval_T *const from,
|
typval_T *const from,
|
||||||
typval_T *const to,
|
typval_T *const to,
|
||||||
const bool deep,
|
const bool deep,
|
||||||
const int copyID)
|
const int copyID)
|
||||||
FUNC_ATTR_NONNULL_ARG(2,3)
|
FUNC_ATTR_NONNULL_ARG(2, 3)
|
||||||
{
|
{
|
||||||
static int recurse = 0;
|
static int recurse = 0;
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
@@ -18645,8 +18645,9 @@ int var_item_copy(const vimconv_T *const conv,
|
|||||||
/* use the copy made earlier */
|
/* use the copy made earlier */
|
||||||
to->vval.v_list = from->vval.v_list->lv_copylist;
|
to->vval.v_list = from->vval.v_list->lv_copylist;
|
||||||
++to->vval.v_list->lv_refcount;
|
++to->vval.v_list->lv_refcount;
|
||||||
} else
|
} else {
|
||||||
to->vval.v_list = list_copy(conv, from->vval.v_list, deep, copyID);
|
to->vval.v_list = list_copy(conv, from->vval.v_list, deep, copyID);
|
||||||
|
}
|
||||||
if (to->vval.v_list == NULL)
|
if (to->vval.v_list == NULL)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
break;
|
break;
|
||||||
@@ -18659,8 +18660,9 @@ int var_item_copy(const vimconv_T *const conv,
|
|||||||
/* use the copy made earlier */
|
/* use the copy made earlier */
|
||||||
to->vval.v_dict = from->vval.v_dict->dv_copydict;
|
to->vval.v_dict = from->vval.v_dict->dv_copydict;
|
||||||
++to->vval.v_dict->dv_refcount;
|
++to->vval.v_dict->dv_refcount;
|
||||||
} else
|
} else {
|
||||||
to->vval.v_dict = dict_copy(conv, from->vval.v_dict, deep, copyID);
|
to->vval.v_dict = dict_copy(conv, from->vval.v_dict, deep, copyID);
|
||||||
|
}
|
||||||
if (to->vval.v_dict == NULL)
|
if (to->vval.v_dict == NULL)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
break;
|
break;
|
||||||
@@ -20875,23 +20877,25 @@ static var_flavour_T var_flavour(char_u *varname)
|
|||||||
|
|
||||||
if (ASCII_ISUPPER(*p)) {
|
if (ASCII_ISUPPER(*p)) {
|
||||||
while (*(++p))
|
while (*(++p))
|
||||||
if (ASCII_ISLOWER(*p))
|
if (ASCII_ISLOWER(*p)) {
|
||||||
return VAR_FLAVOUR_SESSION;
|
return VAR_FLAVOUR_SESSION;
|
||||||
|
}
|
||||||
return VAR_FLAVOUR_SHADA;
|
return VAR_FLAVOUR_SHADA;
|
||||||
} else
|
} else {
|
||||||
return VAR_FLAVOUR_DEFAULT;
|
return VAR_FLAVOUR_DEFAULT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Iterate over global variables
|
/// Iterate over global variables
|
||||||
///
|
///
|
||||||
/// @warning No modifications to global variable dictionary must be performed
|
/// @warning No modifications to global variable dictionary must be performed
|
||||||
/// while iteration is in progress.
|
/// while iteration is in progress.
|
||||||
///
|
///
|
||||||
/// @param[in] iter Iterator. Pass NULL to start iteration.
|
/// @param[in] iter Iterator. Pass NULL to start iteration.
|
||||||
/// @param[out] name Variable name.
|
/// @param[out] name Variable name.
|
||||||
/// @param[out] rettv Variable value.
|
/// @param[out] rettv Variable value.
|
||||||
///
|
///
|
||||||
/// @return Pointer that needs to be passed to next `var_shada_iter` invocation
|
/// @return Pointer that needs to be passed to next `var_shada_iter` invocation
|
||||||
/// or NULL to indicate that iteration is over.
|
/// or NULL to indicate that iteration is over.
|
||||||
const void *var_shada_iter(const void *const iter, const char **const name,
|
const void *var_shada_iter(const void *const iter, const char **const name,
|
||||||
typval_T *rettv)
|
typval_T *rettv)
|
||||||
|
@@ -4268,7 +4268,7 @@ static int
|
|||||||
in_history (
|
in_history (
|
||||||
int type,
|
int type,
|
||||||
char_u *str,
|
char_u *str,
|
||||||
int move_to_front, /* Move the entry to the front if it exists */
|
int move_to_front, // Move the entry to the front if it exists
|
||||||
int sep
|
int sep
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -4309,9 +4309,9 @@ in_history (
|
|||||||
history[type][i].hisstr = str;
|
history[type][i].hisstr = str;
|
||||||
history[type][i].timestamp = os_time();
|
history[type][i].timestamp = os_time();
|
||||||
history[type][i].additional_elements = NULL;
|
history[type][i].additional_elements = NULL;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -4378,7 +4378,7 @@ add_to_history (
|
|||||||
}
|
}
|
||||||
last_maptick = -1;
|
last_maptick = -1;
|
||||||
}
|
}
|
||||||
if (!in_history(histype, new_entry, TRUE, sep)) {
|
if (!in_history(histype, new_entry, true, sep)) {
|
||||||
if (++hisidx[histype] == hislen)
|
if (++hisidx[histype] == hislen)
|
||||||
hisidx[histype] = 0;
|
hisidx[histype] = 0;
|
||||||
hisptr = &history[histype][hisidx[histype]];
|
hisptr = &history[histype][hisidx[histype]];
|
||||||
@@ -4548,7 +4548,7 @@ char_u *get_history_entry(int histype, int idx)
|
|||||||
///
|
///
|
||||||
/// @param[in] histype One of the HIST_ values.
|
/// @param[in] histype One of the HIST_ values.
|
||||||
///
|
///
|
||||||
/// @return OK if there was something to clean and histype was one of HIST_
|
/// @return OK if there was something to clean and histype was one of HIST_
|
||||||
/// values, FAIL otherwise.
|
/// values, FAIL otherwise.
|
||||||
int clr_history(const int histype)
|
int clr_history(const int histype)
|
||||||
{
|
{
|
||||||
@@ -4575,7 +4575,7 @@ int del_history_entry(int histype, char_u *str)
|
|||||||
int idx;
|
int idx;
|
||||||
int i;
|
int i;
|
||||||
int last;
|
int last;
|
||||||
int found = FALSE;
|
bool found = false;
|
||||||
|
|
||||||
regmatch.regprog = NULL;
|
regmatch.regprog = NULL;
|
||||||
regmatch.rm_ic = FALSE; /* always match case */
|
regmatch.rm_ic = FALSE; /* always match case */
|
||||||
@@ -4592,7 +4592,7 @@ int del_history_entry(int histype, char_u *str)
|
|||||||
if (hisptr->hisstr == NULL)
|
if (hisptr->hisstr == NULL)
|
||||||
break;
|
break;
|
||||||
if (vim_regexec(®match, hisptr->hisstr, (colnr_T)0)) {
|
if (vim_regexec(®match, hisptr->hisstr, (colnr_T)0)) {
|
||||||
found = TRUE;
|
found = true;
|
||||||
hist_free_entry(hisptr);
|
hist_free_entry(hisptr);
|
||||||
} else {
|
} else {
|
||||||
if (i != last) {
|
if (i != last) {
|
||||||
@@ -5077,24 +5077,24 @@ char_u *script_get(exarg_T *eap, char_u *cmd)
|
|||||||
|
|
||||||
/// Iterate over history items
|
/// Iterate over history items
|
||||||
///
|
///
|
||||||
/// @warning No history-editing functions must be run while iteration is in
|
/// @warning No history-editing functions must be run while iteration is in
|
||||||
/// progress.
|
/// progress.
|
||||||
///
|
///
|
||||||
/// @param[in] iter Pointer to the last history entry.
|
/// @param[in] iter Pointer to the last history entry.
|
||||||
/// @param[in] history_type Type of the history (HIST_*). Ignored if iter
|
/// @param[in] history_type Type of the history (HIST_*). Ignored if iter
|
||||||
/// parameter is not NULL.
|
/// parameter is not NULL.
|
||||||
/// @param[in] zero If true then zero (but not free) returned items.
|
/// @param[in] zero If true then zero (but not free) returned items.
|
||||||
///
|
///
|
||||||
/// @warning When using this parameter user is
|
/// @warning When using this parameter user is
|
||||||
/// responsible for calling clr_history()
|
/// responsible for calling clr_history()
|
||||||
/// itself after iteration is over. If
|
/// itself after iteration is over. If
|
||||||
/// clr_history() is not called behaviour is
|
/// clr_history() is not called behaviour is
|
||||||
/// undefined. No functions that work with
|
/// undefined. No functions that work with
|
||||||
/// history must be called during iteration
|
/// history must be called during iteration
|
||||||
/// in this case.
|
/// in this case.
|
||||||
/// @param[out] hist Next history entry.
|
/// @param[out] hist Next history entry.
|
||||||
///
|
///
|
||||||
/// @return Pointer used in next iteration or NULL to indicate that iteration
|
/// @return Pointer used in next iteration or NULL to indicate that iteration
|
||||||
/// was finished.
|
/// was finished.
|
||||||
const void *hist_iter(const void *const iter, const uint8_t history_type,
|
const void *hist_iter(const void *const iter, const uint8_t history_type,
|
||||||
const bool zero, histentry_T *const hist)
|
const bool zero, histentry_T *const hist)
|
||||||
@@ -5143,9 +5143,9 @@ const void *hist_iter(const void *const iter, const uint8_t history_type,
|
|||||||
/// Get array of history items
|
/// Get array of history items
|
||||||
///
|
///
|
||||||
/// @param[in] history_type Type of the history to get array for.
|
/// @param[in] history_type Type of the history to get array for.
|
||||||
/// @param[out] new_hisidx Location where last index in the new array should
|
/// @param[out] new_hisidx Location where last index in the new array should
|
||||||
/// be saved.
|
/// be saved.
|
||||||
/// @param[out] new_hisnum Location where last history number in the new
|
/// @param[out] new_hisnum Location where last history number in the new
|
||||||
/// history should be saved.
|
/// history should be saved.
|
||||||
///
|
///
|
||||||
/// @return Pointer to the array or NULL.
|
/// @return Pointer to the array or NULL.
|
||||||
|
@@ -891,8 +891,8 @@ EXTERN int must_redraw INIT(= 0); /* type of redraw necessary */
|
|||||||
EXTERN int skip_redraw INIT(= FALSE); /* skip redraw once */
|
EXTERN int skip_redraw INIT(= FALSE); /* skip redraw once */
|
||||||
EXTERN int do_redraw INIT(= FALSE); /* extra redraw once */
|
EXTERN int do_redraw INIT(= FALSE); /* extra redraw once */
|
||||||
|
|
||||||
EXTERN int need_highlight_changed INIT(= TRUE);
|
EXTERN int need_highlight_changed INIT(= true);
|
||||||
EXTERN char *used_shada_file INIT(= NULL); /* name of ShaDa file to use */
|
EXTERN char *used_shada_file INIT(= NULL); // name of the ShaDa file to use
|
||||||
|
|
||||||
#define NSCRIPT 15
|
#define NSCRIPT 15
|
||||||
EXTERN FILE *scriptin[NSCRIPT]; /* streams to read script from */
|
EXTERN FILE *scriptin[NSCRIPT]; /* streams to read script from */
|
||||||
|
@@ -114,8 +114,8 @@ int main() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __AC_KHASH_H
|
#ifndef NVIM_LIB_KHASH_H
|
||||||
#define __AC_KHASH_H
|
#define NVIM_LIB_KHASH_H
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@header
|
@header
|
||||||
@@ -194,175 +194,229 @@ static const double __ac_HASH_UPPER = 0.77;
|
|||||||
khval_t *vals; \
|
khval_t *vals; \
|
||||||
} kh_##name##_t;
|
} kh_##name##_t;
|
||||||
|
|
||||||
#define __KHASH_PROTOTYPES(name, khkey_t, khval_t) \
|
#define __KHASH_PROTOTYPES(name, khkey_t, khval_t) \
|
||||||
extern kh_##name##_t *kh_init_##name(void); \
|
extern kh_##name##_t *kh_init_##name(void); \
|
||||||
extern void kh_dealloc_##name(kh_##name##_t *h); \
|
extern void kh_dealloc_##name(kh_##name##_t *h); \
|
||||||
extern void kh_destroy_##name(kh_##name##_t *h); \
|
extern void kh_destroy_##name(kh_##name##_t *h); \
|
||||||
extern void kh_clear_##name(kh_##name##_t *h); \
|
extern void kh_clear_##name(kh_##name##_t *h); \
|
||||||
extern khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key); \
|
extern khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key); \
|
||||||
extern void kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets); \
|
extern void kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets); \
|
||||||
extern khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret); \
|
extern khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret); \
|
||||||
extern void kh_del_##name(kh_##name##_t *h, khint_t x);
|
extern void kh_del_##name(kh_##name##_t *h, khint_t x);
|
||||||
|
|
||||||
#define __KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \
|
#define __KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, \
|
||||||
SCOPE kh_##name##_t *kh_init_##name(void) \
|
__hash_equal) \
|
||||||
REAL_FATTR_UNUSED; \
|
SCOPE kh_##name##_t *kh_init_##name(void) \
|
||||||
SCOPE kh_##name##_t *kh_init_##name(void) { \
|
REAL_FATTR_UNUSED; \
|
||||||
return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \
|
SCOPE kh_##name##_t *kh_init_##name(void) { \
|
||||||
} \
|
return (kh_##name##_t*)kcalloc(1, sizeof(kh_##name##_t)); \
|
||||||
SCOPE void kh_dealloc_##name(kh_##name##_t *h) \
|
} \
|
||||||
REAL_FATTR_UNUSED; \
|
SCOPE void kh_dealloc_##name(kh_##name##_t *h) \
|
||||||
SCOPE void kh_dealloc_##name(kh_##name##_t *h) \
|
REAL_FATTR_UNUSED; \
|
||||||
{ \
|
SCOPE void kh_dealloc_##name(kh_##name##_t *h) \
|
||||||
kfree((void *)h->keys); kfree(h->flags); \
|
{ \
|
||||||
kfree((void *)h->vals); \
|
kfree(h->keys); \
|
||||||
} \
|
kfree(h->flags); \
|
||||||
SCOPE void kh_destroy_##name(kh_##name##_t *h) \
|
kfree(h->vals); \
|
||||||
REAL_FATTR_UNUSED; \
|
} \
|
||||||
SCOPE void kh_destroy_##name(kh_##name##_t *h) \
|
SCOPE void kh_destroy_##name(kh_##name##_t *h) \
|
||||||
{ \
|
REAL_FATTR_UNUSED; \
|
||||||
if (h) { \
|
SCOPE void kh_destroy_##name(kh_##name##_t *h) \
|
||||||
kh_dealloc_##name(h); \
|
{ \
|
||||||
kfree(h); \
|
if (h) { \
|
||||||
} \
|
kh_dealloc_##name(h); \
|
||||||
} \
|
kfree(h); \
|
||||||
SCOPE void kh_clear_##name(kh_##name##_t *h) \
|
} \
|
||||||
REAL_FATTR_UNUSED; \
|
} \
|
||||||
SCOPE void kh_clear_##name(kh_##name##_t *h) \
|
SCOPE void kh_clear_##name(kh_##name##_t *h) \
|
||||||
{ \
|
REAL_FATTR_UNUSED; \
|
||||||
if (h && h->flags) { \
|
SCOPE void kh_clear_##name(kh_##name##_t *h) \
|
||||||
memset(h->flags, 0xaa, __ac_fsize(h->n_buckets) * sizeof(khint32_t)); \
|
{ \
|
||||||
h->size = h->n_occupied = 0; \
|
if (h && h->flags) { \
|
||||||
} \
|
memset(h->flags, 0xaa, __ac_fsize(h->n_buckets) * sizeof(khint32_t)); \
|
||||||
} \
|
h->size = h->n_occupied = 0; \
|
||||||
SCOPE khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key) \
|
} \
|
||||||
REAL_FATTR_UNUSED; \
|
} \
|
||||||
SCOPE khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key) \
|
SCOPE khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key) \
|
||||||
{ \
|
REAL_FATTR_UNUSED; \
|
||||||
if (h->n_buckets) { \
|
SCOPE khint_t kh_get_##name(const kh_##name##_t *h, khkey_t key) \
|
||||||
khint_t k, i, last, mask, step = 0; \
|
{ \
|
||||||
mask = h->n_buckets - 1; \
|
if (h->n_buckets) { \
|
||||||
k = __hash_func(key); i = k & mask; \
|
khint_t k, i, last, mask, step = 0; \
|
||||||
last = i; \
|
mask = h->n_buckets - 1; \
|
||||||
while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \
|
k = __hash_func(key); i = k & mask; \
|
||||||
i = (i + (++step)) & mask; \
|
last = i; \
|
||||||
if (i == last) return h->n_buckets; \
|
while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || \
|
||||||
} \
|
!__hash_equal(h->keys[i], key))) { \
|
||||||
return __ac_iseither(h->flags, i)? h->n_buckets : i; \
|
i = (i + (++step)) & mask; \
|
||||||
} else return 0; \
|
if (i == last) { \
|
||||||
} \
|
return h->n_buckets; \
|
||||||
SCOPE void kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets) \
|
} \
|
||||||
REAL_FATTR_UNUSED; \
|
} \
|
||||||
SCOPE void kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets) \
|
return __ac_iseither(h->flags, i) ? h->n_buckets : i; \
|
||||||
{ /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \
|
} else { \
|
||||||
khint32_t *new_flags = 0; \
|
return 0; \
|
||||||
khint_t j = 1; \
|
} \
|
||||||
{ \
|
} \
|
||||||
kroundup32(new_n_buckets); \
|
SCOPE void kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets) \
|
||||||
if (new_n_buckets < 4) new_n_buckets = 4; \
|
REAL_FATTR_UNUSED; \
|
||||||
if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 0; /* requested size is too small */ \
|
SCOPE void kh_resize_##name(kh_##name##_t *h, khint_t new_n_buckets) \
|
||||||
else { /* hash table size to be changed (shrink or expand); rehash */ \
|
{ /* This function uses 0.25*n_buckets bytes of working space instead of */ \
|
||||||
new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \
|
/* [sizeof(key_t+val_t)+.25]*n_buckets. */ \
|
||||||
memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \
|
khint32_t *new_flags = 0; \
|
||||||
if (h->n_buckets < new_n_buckets) { /* expand */ \
|
khint_t j = 1; \
|
||||||
khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \
|
{ \
|
||||||
h->keys = new_keys; \
|
kroundup32(new_n_buckets); \
|
||||||
if (kh_is_map) { \
|
if (new_n_buckets < 4) { \
|
||||||
khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \
|
new_n_buckets = 4; \
|
||||||
h->vals = new_vals; \
|
} \
|
||||||
} \
|
/* requested size is too small */ \
|
||||||
} /* otherwise shrink */ \
|
if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) { \
|
||||||
} \
|
j = 0; \
|
||||||
} \
|
} else { /* hash table size to be changed (shrink or expand); rehash */ \
|
||||||
if (j) { /* rehashing is needed */ \
|
new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) \
|
||||||
for (j = 0; j != h->n_buckets; ++j) { \
|
* sizeof(khint32_t)); \
|
||||||
if (__ac_iseither(h->flags, j) == 0) { \
|
memset(new_flags, 0xaa, \
|
||||||
khkey_t key = h->keys[j]; \
|
__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \
|
||||||
khval_t val; \
|
if (h->n_buckets < new_n_buckets) { /* expand */ \
|
||||||
khint_t new_mask; \
|
khkey_t *new_keys = (khkey_t*)krealloc( \
|
||||||
new_mask = new_n_buckets - 1; \
|
(void *)h->keys, new_n_buckets * sizeof(khkey_t)); \
|
||||||
if (kh_is_map) val = h->vals[j]; \
|
h->keys = new_keys; \
|
||||||
__ac_set_isdel_true(h->flags, j); \
|
if (kh_is_map) { \
|
||||||
while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \
|
khval_t *new_vals = (khval_t*)krealloc( \
|
||||||
khint_t k, i, step = 0; \
|
(void *)h->vals, new_n_buckets * sizeof(khval_t)); \
|
||||||
k = __hash_func(key); \
|
h->vals = new_vals; \
|
||||||
i = k & new_mask; \
|
} \
|
||||||
while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask; \
|
} /* otherwise shrink */ \
|
||||||
__ac_set_isempty_false(new_flags, i); \
|
} \
|
||||||
if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { /* kick out the existing element */ \
|
} \
|
||||||
{ khkey_t tmp = h->keys[i]; h->keys[i] = key; key = tmp; } \
|
if (j) { /* rehashing is needed */ \
|
||||||
if (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \
|
for (j = 0; j != h->n_buckets; ++j) { \
|
||||||
__ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \
|
if (__ac_iseither(h->flags, j) == 0) { \
|
||||||
} else { /* write the element and jump out of the loop */ \
|
khkey_t key = h->keys[j]; \
|
||||||
h->keys[i] = key; \
|
khval_t val; \
|
||||||
if (kh_is_map) h->vals[i] = val; \
|
khint_t new_mask; \
|
||||||
break; \
|
new_mask = new_n_buckets - 1; \
|
||||||
} \
|
if (kh_is_map) { \
|
||||||
} \
|
val = h->vals[j]; \
|
||||||
} \
|
} \
|
||||||
} \
|
__ac_set_isdel_true(h->flags, j); \
|
||||||
if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \
|
/* kick-out process; sort of like in Cuckoo hashing */ \
|
||||||
h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \
|
while (1) { \
|
||||||
if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \
|
khint_t k, i, step = 0; \
|
||||||
} \
|
k = __hash_func(key); \
|
||||||
kfree(h->flags); /* free the working space */ \
|
i = k & new_mask; \
|
||||||
h->flags = new_flags; \
|
while (!__ac_isempty(new_flags, i)) { \
|
||||||
h->n_buckets = new_n_buckets; \
|
i = (i + (++step)) & new_mask; \
|
||||||
h->n_occupied = h->size; \
|
} \
|
||||||
h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \
|
__ac_set_isempty_false(new_flags, i); \
|
||||||
} \
|
/* kick out the existing element */ \
|
||||||
} \
|
if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { \
|
||||||
SCOPE khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \
|
{ \
|
||||||
REAL_FATTR_UNUSED; \
|
khkey_t tmp = h->keys[i]; \
|
||||||
SCOPE khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \
|
h->keys[i] = key; \
|
||||||
{ \
|
key = tmp; \
|
||||||
khint_t x; \
|
} \
|
||||||
if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \
|
if (kh_is_map) { \
|
||||||
if (h->n_buckets > (h->size<<1)) { \
|
khval_t tmp = h->vals[i]; \
|
||||||
kh_resize_##name(h, h->n_buckets - 1); /* clear "deleted" elements */ \
|
h->vals[i] = val; \
|
||||||
} else { \
|
val = tmp; \
|
||||||
kh_resize_##name(h, h->n_buckets + 1); /* expand the hash table */ \
|
} \
|
||||||
} \
|
/* mark it as deleted in the old hash table */ \
|
||||||
} /* TODO: to implement automatically shrinking; resize() already support shrinking */ \
|
__ac_set_isdel_true(h->flags, i); \
|
||||||
{ \
|
} else { /* write the element and jump out of the loop */ \
|
||||||
khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \
|
h->keys[i] = key; \
|
||||||
x = site = h->n_buckets; k = __hash_func(key); i = k & mask; \
|
if (kh_is_map) { \
|
||||||
if (__ac_isempty(h->flags, i)) x = i; /* for speed up */ \
|
h->vals[i] = val; \
|
||||||
else { \
|
} \
|
||||||
last = i; \
|
break; \
|
||||||
while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \
|
} \
|
||||||
if (__ac_isdel(h->flags, i)) site = i; \
|
} \
|
||||||
i = (i + (++step)) & mask; \
|
} \
|
||||||
if (i == last) { x = site; break; } \
|
} \
|
||||||
} \
|
if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \
|
||||||
if (x == h->n_buckets) { \
|
h->keys = (khkey_t*)krealloc((void *)h->keys, \
|
||||||
if (__ac_isempty(h->flags, i) && site != h->n_buckets) x = site; \
|
new_n_buckets * sizeof(khkey_t)); \
|
||||||
else x = i; \
|
if (kh_is_map) { \
|
||||||
} \
|
h->vals = (khval_t*)krealloc((void *)h->vals, \
|
||||||
} \
|
new_n_buckets * sizeof(khval_t)); \
|
||||||
} \
|
} \
|
||||||
if (__ac_isempty(h->flags, x)) { /* not present at all */ \
|
} \
|
||||||
h->keys[x] = key; \
|
kfree(h->flags); /* free the working space */ \
|
||||||
__ac_set_isboth_false(h->flags, x); \
|
h->flags = new_flags; \
|
||||||
++h->size; ++h->n_occupied; \
|
h->n_buckets = new_n_buckets; \
|
||||||
*ret = 1; \
|
h->n_occupied = h->size; \
|
||||||
} else if (__ac_isdel(h->flags, x)) { /* deleted */ \
|
h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \
|
||||||
h->keys[x] = key; \
|
} \
|
||||||
__ac_set_isboth_false(h->flags, x); \
|
} \
|
||||||
++h->size; \
|
SCOPE khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \
|
||||||
*ret = 2; \
|
REAL_FATTR_UNUSED; \
|
||||||
} else *ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \
|
SCOPE khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \
|
||||||
return x; \
|
{ \
|
||||||
} \
|
khint_t x; \
|
||||||
SCOPE void kh_del_##name(kh_##name##_t *h, khint_t x) \
|
if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \
|
||||||
REAL_FATTR_UNUSED; \
|
if (h->n_buckets > (h->size << 1)) { \
|
||||||
SCOPE void kh_del_##name(kh_##name##_t *h, khint_t x) \
|
kh_resize_##name(h, h->n_buckets - 1); /* clear "deleted" elements */ \
|
||||||
{ \
|
} else { \
|
||||||
if (x != h->n_buckets && !__ac_iseither(h->flags, x)) { \
|
kh_resize_##name(h, h->n_buckets + 1); /* expand the hash table */ \
|
||||||
__ac_set_isdel_true(h->flags, x); \
|
} \
|
||||||
--h->size; \
|
} /* TODO: implement automatically shrinking; */ \
|
||||||
} \
|
/* resize() already support shrinking */ \
|
||||||
}
|
{ \
|
||||||
|
khint_t k, i, site, last, mask = h->n_buckets - 1, step = 0; \
|
||||||
|
x = site = h->n_buckets; \
|
||||||
|
k = __hash_func(key); \
|
||||||
|
i = k & mask; \
|
||||||
|
if (__ac_isempty(h->flags, i)) { \
|
||||||
|
x = i; /* for speed up */ \
|
||||||
|
} else { \
|
||||||
|
last = i; \
|
||||||
|
while (!__ac_isempty(h->flags, i) \
|
||||||
|
&& (__ac_isdel(h->flags, i) \
|
||||||
|
|| !__hash_equal(h->keys[i], key))) { \
|
||||||
|
if (__ac_isdel(h->flags, i)) { \
|
||||||
|
site = i; \
|
||||||
|
} \
|
||||||
|
i = (i + (++step)) & mask; \
|
||||||
|
if (i == last) { \
|
||||||
|
x = site; \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
if (x == h->n_buckets) { \
|
||||||
|
if (__ac_isempty(h->flags, i) && site != h->n_buckets) { \
|
||||||
|
x = site; \
|
||||||
|
} else { \
|
||||||
|
x = i; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
if (__ac_isempty(h->flags, x)) { /* not present at all */ \
|
||||||
|
h->keys[x] = key; \
|
||||||
|
__ac_set_isboth_false(h->flags, x); \
|
||||||
|
h->size++; \
|
||||||
|
h->n_occupied++; \
|
||||||
|
*ret = 1; \
|
||||||
|
} else if (__ac_isdel(h->flags, x)) { /* deleted */ \
|
||||||
|
h->keys[x] = key; \
|
||||||
|
__ac_set_isboth_false(h->flags, x); \
|
||||||
|
h->size++; \
|
||||||
|
*ret = 2; \
|
||||||
|
} else { \
|
||||||
|
*ret = 0; /* Don't touch h->keys[x] if present and not deleted */ \
|
||||||
|
} \
|
||||||
|
return x; \
|
||||||
|
} \
|
||||||
|
SCOPE void kh_del_##name(kh_##name##_t *h, khint_t x) \
|
||||||
|
REAL_FATTR_UNUSED; \
|
||||||
|
SCOPE void kh_del_##name(kh_##name##_t *h, khint_t x) \
|
||||||
|
{ \
|
||||||
|
if (x != h->n_buckets && !__ac_iseither(h->flags, x)) { \
|
||||||
|
__ac_set_isdel_true(h->flags, x); \
|
||||||
|
--h->size; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#define KHASH_DECLARE(name, khkey_t, khval_t) \
|
#define KHASH_DECLARE(name, khkey_t, khval_t) \
|
||||||
__KHASH_TYPE(name, khkey_t, khval_t) \
|
__KHASH_TYPE(name, khkey_t, khval_t) \
|
||||||
@@ -599,12 +653,17 @@ static kh_inline khint_t __ac_Wang_hash(khint_t key)
|
|||||||
@param kvar Variable to which value will be assigned
|
@param kvar Variable to which value will be assigned
|
||||||
@param code Block of code to execute
|
@param code Block of code to execute
|
||||||
*/
|
*/
|
||||||
#define kh_foreach_key(h, kvar, code) { khint_t __i; \
|
#define kh_foreach_key(h, kvar, code) \
|
||||||
for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \
|
{ \
|
||||||
if (!kh_exist(h,__i)) continue; \
|
khint_t __i; \
|
||||||
(kvar) = kh_key(h,__i); \
|
for (__i = kh_begin(h); __i != kh_end(h); __i++) { \
|
||||||
code; \
|
if (!kh_exist(h, __i)) { \
|
||||||
} }
|
continue; \
|
||||||
|
} \
|
||||||
|
(kvar) = kh_key(h, __i); \
|
||||||
|
code; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
/* More conenient interfaces */
|
/* More conenient interfaces */
|
||||||
|
|
||||||
@@ -651,21 +710,21 @@ typedef const char *kh_cstr_t;
|
|||||||
@param name Name of the hash table [symbol]
|
@param name Name of the hash table [symbol]
|
||||||
@param khval_t Type of values [type]
|
@param khval_t Type of values [type]
|
||||||
*/
|
*/
|
||||||
#define KHASH_MAP_INIT_STR(name, khval_t) \
|
#define KHASH_MAP_INIT_STR(name, khval_t) \
|
||||||
KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal)
|
KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal)
|
||||||
|
|
||||||
/*! @function
|
/*! @function
|
||||||
@abstract Return a literal for an empty hash table.
|
@abstract Return a literal for an empty hash table.
|
||||||
@param name Name of the hash table [symbol]
|
@param name Name of the hash table [symbol]
|
||||||
*/
|
*/
|
||||||
#define KHASH_EMPTY_TABLE(name) \
|
#define KHASH_EMPTY_TABLE(name) \
|
||||||
((kh_##name##_t) { \
|
((kh_##name##_t) { \
|
||||||
.n_buckets = 0, \
|
.n_buckets = 0, \
|
||||||
.size = 0, \
|
.size = 0, \
|
||||||
.n_occupied = 0, \
|
.n_occupied = 0, \
|
||||||
.upper_bound = 0, \
|
.upper_bound = 0, \
|
||||||
.flags = NULL, \
|
.flags = NULL, \
|
||||||
.keys = NULL, \
|
.keys = NULL, \
|
||||||
.vals = NULL, \
|
.vals = NULL, \
|
||||||
})
|
})
|
||||||
#endif /* __AC_KHASH_H */
|
#endif // NVIM_LIB_KHASH_H
|
||||||
|
@@ -2042,7 +2042,7 @@ static void usage(void)
|
|||||||
mch_msg(_(" -r, -L List swap files and exit\n"));
|
mch_msg(_(" -r, -L List swap files and exit\n"));
|
||||||
mch_msg(_(" -r <file> Recover crashed session\n"));
|
mch_msg(_(" -r <file> Recover crashed session\n"));
|
||||||
mch_msg(_(" -u <nvimrc> Use <nvimrc> instead of the default\n"));
|
mch_msg(_(" -u <nvimrc> Use <nvimrc> instead of the default\n"));
|
||||||
mch_msg(_(" -i <shada> Use <shada> instead of the default " SHADA_FILE "\n"));
|
mch_msg(_(" -i <shada> Use <shada> instead of the default " SHADA_FILE "\n")); // NOLINT(whitespace/line_length)
|
||||||
mch_msg(_(" --noplugin Don't load plugin scripts\n"));
|
mch_msg(_(" --noplugin Don't load plugin scripts\n"));
|
||||||
mch_msg(_(" -o[N] Open N windows (default: one for each file)\n"));
|
mch_msg(_(" -o[N] Open N windows (default: one for each file)\n"));
|
||||||
mch_msg(_(" -O[N] Like -o but split vertically\n"));
|
mch_msg(_(" -O[N] Like -o but split vertically\n"));
|
||||||
|
@@ -312,22 +312,21 @@ pos_T *getmark_buf_fnum(buf_T *buf, int c, int changefile, int *fnum)
|
|||||||
* to crash. */
|
* to crash. */
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
return posp;
|
return posp;
|
||||||
if (c > '~') /* check for islower()/isupper() */
|
if (c > '~') { // check for islower()/isupper()
|
||||||
;
|
} else if (c == '\'' || c == '`') { // previous context mark
|
||||||
else if (c == '\'' || c == '`') { /* previous context mark */
|
pos_copy = curwin->w_pcmark; // need to make a copy because
|
||||||
pos_copy = curwin->w_pcmark; /* need to make a copy because */
|
posp = &pos_copy; // w_pcmark may be changed soon
|
||||||
posp = &pos_copy; /* w_pcmark may be changed soon */
|
} else if (c == '"') { // to pos when leaving buffer
|
||||||
} else if (c == '"') /* to pos when leaving buffer */
|
|
||||||
posp = &(buf->b_last_cursor.mark);
|
posp = &(buf->b_last_cursor.mark);
|
||||||
else if (c == '^') /* to where Insert mode stopped */
|
} else if (c == '^') { // to where Insert mode stopped
|
||||||
posp = &(buf->b_last_insert.mark);
|
posp = &(buf->b_last_insert.mark);
|
||||||
else if (c == '.') /* to where last change was made */
|
} else if (c == '.') { // to where last change was made
|
||||||
posp = &(buf->b_last_change.mark);
|
posp = &(buf->b_last_change.mark);
|
||||||
else if (c == '[') /* to start of previous operator */
|
} else if (c == '[') { // to start of previous operator
|
||||||
posp = &(buf->b_op_start);
|
posp = &(buf->b_op_start);
|
||||||
else if (c == ']') /* to end of previous operator */
|
} else if (c == ']') { // to end of previous operator
|
||||||
posp = &(buf->b_op_end);
|
posp = &(buf->b_op_end);
|
||||||
else if (c == '{' || c == '}') { /* to previous/next paragraph */
|
} else if (c == '{' || c == '}') { // to previous/next paragraph
|
||||||
pos_T pos;
|
pos_T pos;
|
||||||
oparg_T oa;
|
oparg_T oa;
|
||||||
int slcb = listcmd_busy;
|
int slcb = listcmd_busy;
|
||||||
@@ -620,9 +619,9 @@ void do_marks(exarg_T *eap)
|
|||||||
if (arg != NULL && *arg == NUL)
|
if (arg != NULL && *arg == NUL)
|
||||||
arg = NULL;
|
arg = NULL;
|
||||||
|
|
||||||
show_one_mark('\'', arg, &curwin->w_pcmark, NULL, TRUE);
|
show_one_mark('\'', arg, &curwin->w_pcmark, NULL, true);
|
||||||
for (i = 0; i < NMARKS; ++i)
|
for (i = 0; i < NMARKS; ++i)
|
||||||
show_one_mark(i + 'a', arg, &curbuf->b_namedm[i].mark, NULL, TRUE);
|
show_one_mark(i + 'a', arg, &curbuf->b_namedm[i].mark, NULL, true);
|
||||||
for (i = 0; i < NGLOBALMARKS; ++i) {
|
for (i = 0; i < NGLOBALMARKS; ++i) {
|
||||||
if (namedfm[i].fmark.fnum != 0)
|
if (namedfm[i].fmark.fnum != 0)
|
||||||
name = fm_getname(&namedfm[i].fmark, 15);
|
name = fm_getname(&namedfm[i].fmark, 15);
|
||||||
@@ -636,14 +635,14 @@ void do_marks(exarg_T *eap)
|
|||||||
xfree(name);
|
xfree(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
show_one_mark('"', arg, &curbuf->b_last_cursor.mark, NULL, TRUE);
|
show_one_mark('"', arg, &curbuf->b_last_cursor.mark, NULL, true);
|
||||||
show_one_mark('[', arg, &curbuf->b_op_start, NULL, TRUE);
|
show_one_mark('[', arg, &curbuf->b_op_start, NULL, true);
|
||||||
show_one_mark(']', arg, &curbuf->b_op_end, NULL, TRUE);
|
show_one_mark(']', arg, &curbuf->b_op_end, NULL, true);
|
||||||
show_one_mark('^', arg, &curbuf->b_last_insert.mark, NULL, TRUE);
|
show_one_mark('^', arg, &curbuf->b_last_insert.mark, NULL, true);
|
||||||
show_one_mark('.', arg, &curbuf->b_last_change.mark, NULL, TRUE);
|
show_one_mark('.', arg, &curbuf->b_last_change.mark, NULL, true);
|
||||||
show_one_mark('<', arg, &curbuf->b_visual.vi_start, NULL, TRUE);
|
show_one_mark('<', arg, &curbuf->b_visual.vi_start, NULL, true);
|
||||||
show_one_mark('>', arg, &curbuf->b_visual.vi_end, NULL, TRUE);
|
show_one_mark('>', arg, &curbuf->b_visual.vi_end, NULL, true);
|
||||||
show_one_mark(-1, arg, NULL, NULL, FALSE);
|
show_one_mark(-1, arg, NULL, NULL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -737,13 +736,14 @@ void ex_delmarks(exarg_T *eap)
|
|||||||
from = to = *p;
|
from = to = *p;
|
||||||
|
|
||||||
for (i = from; i <= to; ++i) {
|
for (i = from; i <= to; ++i) {
|
||||||
if (lower)
|
if (lower) {
|
||||||
curbuf->b_namedm[i - 'a'].mark.lnum = 0;
|
curbuf->b_namedm[i - 'a'].mark.lnum = 0;
|
||||||
else {
|
} else {
|
||||||
if (digit)
|
if (digit) {
|
||||||
n = i - '0' + NMARKS;
|
n = i - '0' + NMARKS;
|
||||||
else
|
} else {
|
||||||
n = i - 'A';
|
n = i - 'A';
|
||||||
|
}
|
||||||
namedfm[n].fmark.mark.lnum = 0;
|
namedfm[n].fmark.mark.lnum = 0;
|
||||||
xfree(namedfm[n].fname);
|
xfree(namedfm[n].fname);
|
||||||
namedfm[n].fname = NULL;
|
namedfm[n].fname = NULL;
|
||||||
@@ -1127,10 +1127,10 @@ void cleanup_jumplist(void)
|
|||||||
&& curwin->w_jumplist[i].fmark.mark.lnum
|
&& curwin->w_jumplist[i].fmark.mark.lnum
|
||||||
== curwin->w_jumplist[from].fmark.mark.lnum)
|
== curwin->w_jumplist[from].fmark.mark.lnum)
|
||||||
break;
|
break;
|
||||||
if (i >= curwin->w_jumplistlen) { // no duplicate
|
if (i >= curwin->w_jumplistlen) { // no duplicate
|
||||||
if (to != from) {
|
if (to != from) {
|
||||||
// Not using curwin->w_jumplist[to++] = curwin->w_jumplist[from] because
|
// Not using curwin->w_jumplist[to++] = curwin->w_jumplist[from] because
|
||||||
// this way valgrind complains about overlapping source and destination
|
// this way valgrind complains about overlapping source and destination
|
||||||
// in memcpy() call. (clang-3.6.0, debug build with -DEXITFREE).
|
// in memcpy() call. (clang-3.6.0, debug build with -DEXITFREE).
|
||||||
curwin->w_jumplist[to] = curwin->w_jumplist[from];
|
curwin->w_jumplist[to] = curwin->w_jumplist[from];
|
||||||
}
|
}
|
||||||
@@ -1162,14 +1162,14 @@ void copy_jumplist(win_T *from, win_T *to)
|
|||||||
|
|
||||||
/// Iterate over jumplist items
|
/// Iterate over jumplist items
|
||||||
///
|
///
|
||||||
/// @warning No jumplist-editing functions must be run while iteration is in
|
/// @warning No jumplist-editing functions must be run while iteration is in
|
||||||
/// progress.
|
/// progress.
|
||||||
///
|
///
|
||||||
/// @param[in] iter Iterator. Pass NULL to start iteration.
|
/// @param[in] iter Iterator. Pass NULL to start iteration.
|
||||||
/// @param[in] win Window for which jump list is processed.
|
/// @param[in] win Window for which jump list is processed.
|
||||||
/// @param[out] fm Item definition.
|
/// @param[out] fm Item definition.
|
||||||
///
|
///
|
||||||
/// @return Pointer that needs to be passed to next `mark_jumplist_iter` call or
|
/// @return Pointer that needs to be passed to next `mark_jumplist_iter` call or
|
||||||
/// NULL if iteration is over.
|
/// NULL if iteration is over.
|
||||||
const void *mark_jumplist_iter(const void *const iter, const win_T *const win,
|
const void *mark_jumplist_iter(const void *const iter, const win_T *const win,
|
||||||
xfmark_T *const fm)
|
xfmark_T *const fm)
|
||||||
@@ -1193,14 +1193,14 @@ const void *mark_jumplist_iter(const void *const iter, const win_T *const win,
|
|||||||
|
|
||||||
/// Iterate over global marks
|
/// Iterate over global marks
|
||||||
///
|
///
|
||||||
/// @warning No mark-editing functions must be run while iteration is in
|
/// @warning No mark-editing functions must be run while iteration is in
|
||||||
/// progress.
|
/// progress.
|
||||||
///
|
///
|
||||||
/// @param[in] iter Iterator. Pass NULL to start iteration.
|
/// @param[in] iter Iterator. Pass NULL to start iteration.
|
||||||
/// @param[out] name Mark name.
|
/// @param[out] name Mark name.
|
||||||
/// @param[out] fm Mark definition.
|
/// @param[out] fm Mark definition.
|
||||||
///
|
///
|
||||||
/// @return Pointer that needs to be passed to next `mark_global_iter` call or
|
/// @return Pointer that needs to be passed to next `mark_global_iter` call or
|
||||||
/// NULL if iteration is over.
|
/// NULL if iteration is over.
|
||||||
const void *mark_global_iter(const void *const iter, char *const name,
|
const void *mark_global_iter(const void *const iter, char *const name,
|
||||||
xfmark_T *const fm)
|
xfmark_T *const fm)
|
||||||
@@ -1234,11 +1234,11 @@ const void *mark_global_iter(const void *const iter, char *const name,
|
|||||||
/// Get next mark and its name
|
/// Get next mark and its name
|
||||||
///
|
///
|
||||||
/// @param[in] buf Buffer for which next mark is taken.
|
/// @param[in] buf Buffer for which next mark is taken.
|
||||||
/// @param[in,out] mark_name Pointer to the current mark name. Next mark name
|
/// @param[in,out] mark_name Pointer to the current mark name. Next mark name
|
||||||
/// will be saved at this address as well.
|
/// will be saved at this address as well.
|
||||||
///
|
///
|
||||||
/// Current mark name must either be NUL, '"', '^',
|
/// Current mark name must either be NUL, '"', '^',
|
||||||
/// '.' or 'a' .. 'z'. If it is neither of these
|
/// '.' or 'a' .. 'z'. If it is neither of these
|
||||||
/// behaviour is undefined.
|
/// behaviour is undefined.
|
||||||
///
|
///
|
||||||
/// @return Pointer to the next mark or NULL.
|
/// @return Pointer to the next mark or NULL.
|
||||||
@@ -1275,7 +1275,7 @@ static inline const fmark_T *next_buffer_mark(const buf_T *const buf,
|
|||||||
|
|
||||||
/// Iterate over buffer marks
|
/// Iterate over buffer marks
|
||||||
///
|
///
|
||||||
/// @warning No mark-editing functions must be run while iteration is in
|
/// @warning No mark-editing functions must be run while iteration is in
|
||||||
/// progress.
|
/// progress.
|
||||||
///
|
///
|
||||||
/// @param[in] iter Iterator. Pass NULL to start iteration.
|
/// @param[in] iter Iterator. Pass NULL to start iteration.
|
||||||
@@ -1283,7 +1283,7 @@ static inline const fmark_T *next_buffer_mark(const buf_T *const buf,
|
|||||||
/// @param[out] name Mark name.
|
/// @param[out] name Mark name.
|
||||||
/// @param[out] fm Mark definition.
|
/// @param[out] fm Mark definition.
|
||||||
///
|
///
|
||||||
/// @return Pointer that needs to be passed to next `mark_buffer_iter` call or
|
/// @return Pointer that needs to be passed to next `mark_buffer_iter` call or
|
||||||
/// NULL if iteration is over.
|
/// NULL if iteration is over.
|
||||||
const void *mark_buffer_iter(const void *const iter, const buf_T *const buf,
|
const void *mark_buffer_iter(const void *const iter, const buf_T *const buf,
|
||||||
char *const name, fmark_T *const fm)
|
char *const name, fmark_T *const fm)
|
||||||
@@ -1321,7 +1321,7 @@ const void *mark_buffer_iter(const void *const iter, const buf_T *const buf,
|
|||||||
///
|
///
|
||||||
/// @param[in] name Mark name.
|
/// @param[in] name Mark name.
|
||||||
/// @param[in] fm Mark to be set.
|
/// @param[in] fm Mark to be set.
|
||||||
/// @param[in] update If true then only set global mark if it was created
|
/// @param[in] update If true then only set global mark if it was created
|
||||||
/// later then existing one.
|
/// later then existing one.
|
||||||
///
|
///
|
||||||
/// @return true on success, false on failure.
|
/// @return true on success, false on failure.
|
||||||
@@ -1347,7 +1347,7 @@ bool mark_set_global(const char name, const xfmark_T fm, const bool update)
|
|||||||
/// @param[in] name Mark name.
|
/// @param[in] name Mark name.
|
||||||
/// @param[in] buf Pointer to the buffer to set mark in.
|
/// @param[in] buf Pointer to the buffer to set mark in.
|
||||||
/// @param[in] fm Mark to be set.
|
/// @param[in] fm Mark to be set.
|
||||||
/// @param[in] update If true then only set global mark if it was created
|
/// @param[in] update If true then only set global mark if it was created
|
||||||
/// later then existing one.
|
/// later then existing one.
|
||||||
///
|
///
|
||||||
/// @return true on success, false on failure.
|
/// @return true on success, false on failure.
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
/// Total possible number of local marks
|
/// Total possible number of local marks
|
||||||
///
|
///
|
||||||
/// That are uppercase marks plus '"', '^' and '.'. There are other local marks,
|
/// That are uppercase marks plus '"', '^' and '.'. There are other local marks,
|
||||||
/// but they are not saved in ShaDa files.
|
/// but they are not saved in ShaDa files.
|
||||||
#define NLOCALMARKS (NMARKS + 3)
|
#define NLOCALMARKS (NMARKS + 3)
|
||||||
|
|
||||||
|
@@ -5190,7 +5190,7 @@ static bool get_clipboard(int name, yankreg_T **target, bool quiet)
|
|||||||
reg->y_size = lines->lv_len;
|
reg->y_size = lines->lv_len;
|
||||||
reg->additional_data = NULL;
|
reg->additional_data = NULL;
|
||||||
reg->timestamp = 0;
|
reg->timestamp = 0;
|
||||||
// Timestamp is not saved for clipboard registers because clipboard registers
|
// Timestamp is not saved for clipboard registers because clipboard registers
|
||||||
// are not saved in the ShaDa file.
|
// are not saved in the ShaDa file.
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -5327,7 +5327,7 @@ static inline bool reg_empty(const yankreg_T *const reg)
|
|||||||
/// @param[out] name Register name.
|
/// @param[out] name Register name.
|
||||||
/// @param[out] reg Register contents.
|
/// @param[out] reg Register contents.
|
||||||
///
|
///
|
||||||
/// @return Pointer that needs to be passed to next `op_register_iter` call or
|
/// @return Pointer that needs to be passed to next `op_register_iter` call or
|
||||||
/// NULL if iteration is over.
|
/// NULL if iteration is over.
|
||||||
const void *op_register_iter(const void *const iter, char *const name,
|
const void *op_register_iter(const void *const iter, char *const name,
|
||||||
yankreg_T *const reg)
|
yankreg_T *const reg)
|
||||||
|
@@ -2441,9 +2441,8 @@ did_set_string_option (
|
|||||||
verbose_stop();
|
verbose_stop();
|
||||||
if (*p_vfile != NUL && verbose_open() == FAIL)
|
if (*p_vfile != NUL && verbose_open() == FAIL)
|
||||||
errmsg = e_invarg;
|
errmsg = e_invarg;
|
||||||
}
|
|
||||||
/* 'shada' */
|
/* 'shada' */
|
||||||
else if (varp == &p_shada) {
|
} else if (varp == &p_shada) {
|
||||||
for (s = p_shada; *s; ) {
|
for (s = p_shada; *s; ) {
|
||||||
/* Check it's a valid character */
|
/* Check it's a valid character */
|
||||||
if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL) {
|
if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL) {
|
||||||
|
@@ -4633,7 +4633,7 @@ void set_substitute_pattern(const SearchPattern pat)
|
|||||||
|
|
||||||
/// Set last used search pattern
|
/// Set last used search pattern
|
||||||
///
|
///
|
||||||
/// @param[in] is_substitute_pattern If true set substitute pattern as last
|
/// @param[in] is_substitute_pattern If true set substitute pattern as last
|
||||||
/// used. Otherwise sets search pattern.
|
/// used. Otherwise sets search pattern.
|
||||||
void set_last_used_pattern(const bool is_substitute_pattern)
|
void set_last_used_pattern(const bool is_substitute_pattern)
|
||||||
{
|
{
|
||||||
|
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
/// Structure containing offset definition for the last search pattern
|
/// Structure containing offset definition for the last search pattern
|
||||||
///
|
///
|
||||||
/// @note Only offset for the last search pattern is used, not for the last
|
/// @note Only offset for the last search pattern is used, not for the last
|
||||||
/// substitute pattern.
|
/// substitute pattern.
|
||||||
typedef struct soffset {
|
typedef struct soffset {
|
||||||
char dir; ///< Search direction: forward ('/') or backward ('?')
|
char dir; ///< Search direction: forward ('/') or backward ('?')
|
||||||
|
Reference in New Issue
Block a user