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] 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.
|
||||
/// @param[in] col Column number to be set.
|
||||
/// @param[in] copy_options If true save the local window option values.
|
||||
|
@@ -512,10 +512,10 @@ struct file_buffer {
|
||||
visualinfo_T b_visual;
|
||||
int b_visual_mode_eval; /* b_visual.vi_mode for visualmode() */
|
||||
|
||||
fmark_T b_last_cursor; /* cursor position when last unloading this
|
||||
buffer */
|
||||
fmark_T b_last_insert; /* where Insert mode was left */
|
||||
fmark_T b_last_change; /* position of last change: '. mark */
|
||||
fmark_T b_last_cursor; // cursor position when last unloading this
|
||||
// buffer
|
||||
fmark_T b_last_insert; // where Insert mode was left
|
||||
fmark_T b_last_change; // position of last change: '. mark
|
||||
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/* make a copy of the first list. */
|
||||
l = list_copy(NULL, l1, FALSE, 0);
|
||||
l = list_copy(NULL, l1, false, 0);
|
||||
if (l == NULL)
|
||||
return FAIL;
|
||||
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] 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.
|
||||
static list_T *list_copy(const vimconv_T *const conv,
|
||||
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] copyID See var_item_copy().
|
||||
///
|
||||
/// @return Copied dictionary. May be NULL in case original dictionary is NULL
|
||||
/// or some failure happens. The refcount of the new dictionary is set
|
||||
/// @return Copied dictionary. May be NULL in case original dictionary is NULL
|
||||
/// or some failure happens. The refcount of the new dictionary is set
|
||||
/// to 1.
|
||||
static dict_T *dict_copy(const vimconv_T *const conv,
|
||||
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] from Value to copy.
|
||||
/// @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).
|
||||
/// @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.
|
||||
/// when copying list `list = [list2, list2]` (`list[0] is
|
||||
/// list[1]`) var_item_copy with zero copyID will emit
|
||||
/// 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
|
||||
/// @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.
|
||||
/// when copying list `list = [list2, list2]` (`list[0] is
|
||||
/// list[1]`) var_item_copy with zero copyID will emit
|
||||
/// 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
|
||||
/// original list. Not use when deep is false.
|
||||
int var_item_copy(const vimconv_T *const conv,
|
||||
typval_T *const from,
|
||||
typval_T *const to,
|
||||
const bool deep,
|
||||
const int copyID)
|
||||
FUNC_ATTR_NONNULL_ARG(2,3)
|
||||
FUNC_ATTR_NONNULL_ARG(2, 3)
|
||||
{
|
||||
static int recurse = 0;
|
||||
int ret = OK;
|
||||
@@ -18645,8 +18645,9 @@ int var_item_copy(const vimconv_T *const conv,
|
||||
/* use the copy made earlier */
|
||||
to->vval.v_list = from->vval.v_list->lv_copylist;
|
||||
++to->vval.v_list->lv_refcount;
|
||||
} else
|
||||
} else {
|
||||
to->vval.v_list = list_copy(conv, from->vval.v_list, deep, copyID);
|
||||
}
|
||||
if (to->vval.v_list == NULL)
|
||||
ret = FAIL;
|
||||
break;
|
||||
@@ -18659,8 +18660,9 @@ int var_item_copy(const vimconv_T *const conv,
|
||||
/* use the copy made earlier */
|
||||
to->vval.v_dict = from->vval.v_dict->dv_copydict;
|
||||
++to->vval.v_dict->dv_refcount;
|
||||
} else
|
||||
} else {
|
||||
to->vval.v_dict = dict_copy(conv, from->vval.v_dict, deep, copyID);
|
||||
}
|
||||
if (to->vval.v_dict == NULL)
|
||||
ret = FAIL;
|
||||
break;
|
||||
@@ -20875,23 +20877,25 @@ static var_flavour_T var_flavour(char_u *varname)
|
||||
|
||||
if (ASCII_ISUPPER(*p)) {
|
||||
while (*(++p))
|
||||
if (ASCII_ISLOWER(*p))
|
||||
if (ASCII_ISLOWER(*p)) {
|
||||
return VAR_FLAVOUR_SESSION;
|
||||
}
|
||||
return VAR_FLAVOUR_SHADA;
|
||||
} else
|
||||
} else {
|
||||
return VAR_FLAVOUR_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
/// 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.
|
||||
///
|
||||
/// @param[in] iter Iterator. Pass NULL to start iteration.
|
||||
/// @param[out] name Variable name.
|
||||
/// @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.
|
||||
const void *var_shada_iter(const void *const iter, const char **const name,
|
||||
typval_T *rettv)
|
||||
|
@@ -4268,7 +4268,7 @@ static int
|
||||
in_history (
|
||||
int type,
|
||||
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
|
||||
)
|
||||
{
|
||||
@@ -4309,9 +4309,9 @@ in_history (
|
||||
history[type][i].hisstr = str;
|
||||
history[type][i].timestamp = os_time();
|
||||
history[type][i].additional_elements = NULL;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4378,7 +4378,7 @@ add_to_history (
|
||||
}
|
||||
last_maptick = -1;
|
||||
}
|
||||
if (!in_history(histype, new_entry, TRUE, sep)) {
|
||||
if (!in_history(histype, new_entry, true, sep)) {
|
||||
if (++hisidx[histype] == hislen)
|
||||
hisidx[histype] = 0;
|
||||
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.
|
||||
///
|
||||
/// @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.
|
||||
int clr_history(const int histype)
|
||||
{
|
||||
@@ -4575,7 +4575,7 @@ int del_history_entry(int histype, char_u *str)
|
||||
int idx;
|
||||
int i;
|
||||
int last;
|
||||
int found = FALSE;
|
||||
bool found = false;
|
||||
|
||||
regmatch.regprog = NULL;
|
||||
regmatch.rm_ic = FALSE; /* always match case */
|
||||
@@ -4592,7 +4592,7 @@ int del_history_entry(int histype, char_u *str)
|
||||
if (hisptr->hisstr == NULL)
|
||||
break;
|
||||
if (vim_regexec(®match, hisptr->hisstr, (colnr_T)0)) {
|
||||
found = TRUE;
|
||||
found = true;
|
||||
hist_free_entry(hisptr);
|
||||
} else {
|
||||
if (i != last) {
|
||||
@@ -5077,24 +5077,24 @@ char_u *script_get(exarg_T *eap, char_u *cmd)
|
||||
|
||||
/// 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.
|
||||
///
|
||||
/// @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.
|
||||
/// @param[in] zero If true then zero (but not free) returned items.
|
||||
///
|
||||
/// @warning When using this parameter user is
|
||||
/// responsible for calling clr_history()
|
||||
/// itself after iteration is over. If
|
||||
/// clr_history() is not called behaviour is
|
||||
/// undefined. No functions that work with
|
||||
/// history must be called during iteration
|
||||
/// @warning When using this parameter user is
|
||||
/// responsible for calling clr_history()
|
||||
/// itself after iteration is over. If
|
||||
/// clr_history() is not called behaviour is
|
||||
/// undefined. No functions that work with
|
||||
/// history must be called during iteration
|
||||
/// in this case.
|
||||
/// @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.
|
||||
const void *hist_iter(const void *const iter, const uint8_t history_type,
|
||||
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
|
||||
///
|
||||
/// @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.
|
||||
/// @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.
|
||||
///
|
||||
/// @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 do_redraw INIT(= FALSE); /* extra redraw once */
|
||||
|
||||
EXTERN int need_highlight_changed INIT(= TRUE);
|
||||
EXTERN char *used_shada_file INIT(= NULL); /* name of ShaDa file to use */
|
||||
EXTERN int need_highlight_changed INIT(= true);
|
||||
EXTERN char *used_shada_file INIT(= NULL); // name of the ShaDa file to use
|
||||
|
||||
#define NSCRIPT 15
|
||||
EXTERN FILE *scriptin[NSCRIPT]; /* streams to read script from */
|
||||
|
@@ -114,8 +114,8 @@ int main() {
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __AC_KHASH_H
|
||||
#define __AC_KHASH_H
|
||||
#ifndef NVIM_LIB_KHASH_H
|
||||
#define NVIM_LIB_KHASH_H
|
||||
|
||||
/*!
|
||||
@header
|
||||
@@ -194,175 +194,229 @@ static const double __ac_HASH_UPPER = 0.77;
|
||||
khval_t *vals; \
|
||||
} kh_##name##_t;
|
||||
|
||||
#define __KHASH_PROTOTYPES(name, khkey_t, khval_t) \
|
||||
extern kh_##name##_t *kh_init_##name(void); \
|
||||
extern void kh_dealloc_##name(kh_##name##_t *h); \
|
||||
extern void kh_destroy_##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 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 void kh_del_##name(kh_##name##_t *h, khint_t x);
|
||||
#define __KHASH_PROTOTYPES(name, khkey_t, khval_t) \
|
||||
extern kh_##name##_t *kh_init_##name(void); \
|
||||
extern void kh_dealloc_##name(kh_##name##_t *h); \
|
||||
extern void kh_destroy_##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 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 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) \
|
||||
SCOPE kh_##name##_t *kh_init_##name(void) \
|
||||
REAL_FATTR_UNUSED; \
|
||||
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) \
|
||||
{ \
|
||||
kfree((void *)h->keys); kfree(h->flags); \
|
||||
kfree((void *)h->vals); \
|
||||
} \
|
||||
SCOPE void kh_destroy_##name(kh_##name##_t *h) \
|
||||
REAL_FATTR_UNUSED; \
|
||||
SCOPE void kh_destroy_##name(kh_##name##_t *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) \
|
||||
{ \
|
||||
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) \
|
||||
{ \
|
||||
if (h->n_buckets) { \
|
||||
khint_t k, i, last, mask, step = 0; \
|
||||
mask = h->n_buckets - 1; \
|
||||
k = __hash_func(key); i = k & mask; \
|
||||
last = i; \
|
||||
while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || !__hash_equal(h->keys[i], key))) { \
|
||||
i = (i + (++step)) & mask; \
|
||||
if (i == last) return h->n_buckets; \
|
||||
} \
|
||||
return __ac_iseither(h->flags, i)? h->n_buckets : i; \
|
||||
} else return 0; \
|
||||
} \
|
||||
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) \
|
||||
{ /* This function uses 0.25*n_buckets bytes of working space instead of [sizeof(key_t+val_t)+.25]*n_buckets. */ \
|
||||
khint32_t *new_flags = 0; \
|
||||
khint_t j = 1; \
|
||||
{ \
|
||||
kroundup32(new_n_buckets); \
|
||||
if (new_n_buckets < 4) new_n_buckets = 4; \
|
||||
if (h->size >= (khint_t)(new_n_buckets * __ac_HASH_UPPER + 0.5)) j = 0; /* requested size is too small */ \
|
||||
else { /* hash table size to be changed (shrink or expand); rehash */ \
|
||||
new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \
|
||||
memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \
|
||||
if (h->n_buckets < new_n_buckets) { /* expand */ \
|
||||
khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \
|
||||
h->keys = new_keys; \
|
||||
if (kh_is_map) { \
|
||||
khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \
|
||||
h->vals = new_vals; \
|
||||
} \
|
||||
} /* otherwise shrink */ \
|
||||
} \
|
||||
} \
|
||||
if (j) { /* rehashing is needed */ \
|
||||
for (j = 0; j != h->n_buckets; ++j) { \
|
||||
if (__ac_iseither(h->flags, j) == 0) { \
|
||||
khkey_t key = h->keys[j]; \
|
||||
khval_t val; \
|
||||
khint_t new_mask; \
|
||||
new_mask = new_n_buckets - 1; \
|
||||
if (kh_is_map) val = h->vals[j]; \
|
||||
__ac_set_isdel_true(h->flags, j); \
|
||||
while (1) { /* kick-out process; sort of like in Cuckoo hashing */ \
|
||||
khint_t k, i, step = 0; \
|
||||
k = __hash_func(key); \
|
||||
i = k & new_mask; \
|
||||
while (!__ac_isempty(new_flags, i)) i = (i + (++step)) & new_mask; \
|
||||
__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 (kh_is_map) { khval_t tmp = h->vals[i]; h->vals[i] = val; val = tmp; } \
|
||||
__ac_set_isdel_true(h->flags, i); /* mark it as deleted in the old hash table */ \
|
||||
} else { /* write the element and jump out of the loop */ \
|
||||
h->keys[i] = key; \
|
||||
if (kh_is_map) h->vals[i] = val; \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \
|
||||
h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \
|
||||
if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \
|
||||
} \
|
||||
kfree(h->flags); /* free the working space */ \
|
||||
h->flags = new_flags; \
|
||||
h->n_buckets = new_n_buckets; \
|
||||
h->n_occupied = h->size; \
|
||||
h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \
|
||||
} \
|
||||
} \
|
||||
SCOPE khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \
|
||||
REAL_FATTR_UNUSED; \
|
||||
SCOPE khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \
|
||||
{ \
|
||||
khint_t x; \
|
||||
if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \
|
||||
if (h->n_buckets > (h->size<<1)) { \
|
||||
kh_resize_##name(h, h->n_buckets - 1); /* clear "deleted" elements */ \
|
||||
} else { \
|
||||
kh_resize_##name(h, h->n_buckets + 1); /* expand the hash table */ \
|
||||
} \
|
||||
} /* TODO: to 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_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, \
|
||||
__hash_equal) \
|
||||
SCOPE kh_##name##_t *kh_init_##name(void) \
|
||||
REAL_FATTR_UNUSED; \
|
||||
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) \
|
||||
{ \
|
||||
kfree(h->keys); \
|
||||
kfree(h->flags); \
|
||||
kfree(h->vals); \
|
||||
} \
|
||||
SCOPE void kh_destroy_##name(kh_##name##_t *h) \
|
||||
REAL_FATTR_UNUSED; \
|
||||
SCOPE void kh_destroy_##name(kh_##name##_t *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) \
|
||||
{ \
|
||||
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) \
|
||||
{ \
|
||||
if (h->n_buckets) { \
|
||||
khint_t k, i, last, mask, step = 0; \
|
||||
mask = h->n_buckets - 1; \
|
||||
k = __hash_func(key); i = k & mask; \
|
||||
last = i; \
|
||||
while (!__ac_isempty(h->flags, i) && (__ac_isdel(h->flags, i) || \
|
||||
!__hash_equal(h->keys[i], key))) { \
|
||||
i = (i + (++step)) & mask; \
|
||||
if (i == last) { \
|
||||
return h->n_buckets; \
|
||||
} \
|
||||
} \
|
||||
return __ac_iseither(h->flags, i) ? h->n_buckets : i; \
|
||||
} else { \
|
||||
return 0; \
|
||||
} \
|
||||
} \
|
||||
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) \
|
||||
{ /* This function uses 0.25*n_buckets bytes of working space instead of */ \
|
||||
/* [sizeof(key_t+val_t)+.25]*n_buckets. */ \
|
||||
khint32_t *new_flags = 0; \
|
||||
khint_t j = 1; \
|
||||
{ \
|
||||
kroundup32(new_n_buckets); \
|
||||
if (new_n_buckets < 4) { \
|
||||
new_n_buckets = 4; \
|
||||
} \
|
||||
/* requested size is too small */ \
|
||||
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 */ \
|
||||
new_flags = (khint32_t*)kmalloc(__ac_fsize(new_n_buckets) \
|
||||
* sizeof(khint32_t)); \
|
||||
memset(new_flags, 0xaa, \
|
||||
__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \
|
||||
if (h->n_buckets < new_n_buckets) { /* expand */ \
|
||||
khkey_t *new_keys = (khkey_t*)krealloc( \
|
||||
(void *)h->keys, new_n_buckets * sizeof(khkey_t)); \
|
||||
h->keys = new_keys; \
|
||||
if (kh_is_map) { \
|
||||
khval_t *new_vals = (khval_t*)krealloc( \
|
||||
(void *)h->vals, new_n_buckets * sizeof(khval_t)); \
|
||||
h->vals = new_vals; \
|
||||
} \
|
||||
} /* otherwise shrink */ \
|
||||
} \
|
||||
} \
|
||||
if (j) { /* rehashing is needed */ \
|
||||
for (j = 0; j != h->n_buckets; ++j) { \
|
||||
if (__ac_iseither(h->flags, j) == 0) { \
|
||||
khkey_t key = h->keys[j]; \
|
||||
khval_t val; \
|
||||
khint_t new_mask; \
|
||||
new_mask = new_n_buckets - 1; \
|
||||
if (kh_is_map) { \
|
||||
val = h->vals[j]; \
|
||||
} \
|
||||
__ac_set_isdel_true(h->flags, j); \
|
||||
/* kick-out process; sort of like in Cuckoo hashing */ \
|
||||
while (1) { \
|
||||
khint_t k, i, step = 0; \
|
||||
k = __hash_func(key); \
|
||||
i = k & new_mask; \
|
||||
while (!__ac_isempty(new_flags, i)) { \
|
||||
i = (i + (++step)) & new_mask; \
|
||||
} \
|
||||
__ac_set_isempty_false(new_flags, i); \
|
||||
/* kick out the existing element */ \
|
||||
if (i < h->n_buckets && __ac_iseither(h->flags, i) == 0) { \
|
||||
{ \
|
||||
khkey_t tmp = h->keys[i]; \
|
||||
h->keys[i] = key; \
|
||||
key = tmp; \
|
||||
} \
|
||||
if (kh_is_map) { \
|
||||
khval_t tmp = h->vals[i]; \
|
||||
h->vals[i] = val; \
|
||||
val = tmp; \
|
||||
} \
|
||||
/* mark it as deleted in the old hash table */ \
|
||||
__ac_set_isdel_true(h->flags, i); \
|
||||
} else { /* write the element and jump out of the loop */ \
|
||||
h->keys[i] = key; \
|
||||
if (kh_is_map) { \
|
||||
h->vals[i] = val; \
|
||||
} \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \
|
||||
h->keys = (khkey_t*)krealloc((void *)h->keys, \
|
||||
new_n_buckets * sizeof(khkey_t)); \
|
||||
if (kh_is_map) { \
|
||||
h->vals = (khval_t*)krealloc((void *)h->vals, \
|
||||
new_n_buckets * sizeof(khval_t)); \
|
||||
} \
|
||||
} \
|
||||
kfree(h->flags); /* free the working space */ \
|
||||
h->flags = new_flags; \
|
||||
h->n_buckets = new_n_buckets; \
|
||||
h->n_occupied = h->size; \
|
||||
h->upper_bound = (khint_t)(h->n_buckets * __ac_HASH_UPPER + 0.5); \
|
||||
} \
|
||||
} \
|
||||
SCOPE khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \
|
||||
REAL_FATTR_UNUSED; \
|
||||
SCOPE khint_t kh_put_##name(kh_##name##_t *h, khkey_t key, int *ret) \
|
||||
{ \
|
||||
khint_t x; \
|
||||
if (h->n_occupied >= h->upper_bound) { /* update the hash table */ \
|
||||
if (h->n_buckets > (h->size << 1)) { \
|
||||
kh_resize_##name(h, h->n_buckets - 1); /* clear "deleted" elements */ \
|
||||
} else { \
|
||||
kh_resize_##name(h, h->n_buckets + 1); /* expand the hash table */ \
|
||||
} \
|
||||
} /* 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) \
|
||||
__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 code Block of code to execute
|
||||
*/
|
||||
#define kh_foreach_key(h, kvar, code) { khint_t __i; \
|
||||
for (__i = kh_begin(h); __i != kh_end(h); ++__i) { \
|
||||
if (!kh_exist(h,__i)) continue; \
|
||||
(kvar) = kh_key(h,__i); \
|
||||
code; \
|
||||
} }
|
||||
#define kh_foreach_key(h, kvar, code) \
|
||||
{ \
|
||||
khint_t __i; \
|
||||
for (__i = kh_begin(h); __i != kh_end(h); __i++) { \
|
||||
if (!kh_exist(h, __i)) { \
|
||||
continue; \
|
||||
} \
|
||||
(kvar) = kh_key(h, __i); \
|
||||
code; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* More conenient interfaces */
|
||||
|
||||
@@ -651,21 +710,21 @@ typedef const char *kh_cstr_t;
|
||||
@param name Name of the hash table [symbol]
|
||||
@param khval_t Type of values [type]
|
||||
*/
|
||||
#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)
|
||||
#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)
|
||||
|
||||
/*! @function
|
||||
@abstract Return a literal for an empty hash table.
|
||||
@param name Name of the hash table [symbol]
|
||||
*/
|
||||
#define KHASH_EMPTY_TABLE(name) \
|
||||
((kh_##name##_t) { \
|
||||
.n_buckets = 0, \
|
||||
.size = 0, \
|
||||
.n_occupied = 0, \
|
||||
.upper_bound = 0, \
|
||||
.flags = NULL, \
|
||||
.keys = NULL, \
|
||||
.vals = NULL, \
|
||||
})
|
||||
#endif /* __AC_KHASH_H */
|
||||
((kh_##name##_t) { \
|
||||
.n_buckets = 0, \
|
||||
.size = 0, \
|
||||
.n_occupied = 0, \
|
||||
.upper_bound = 0, \
|
||||
.flags = NULL, \
|
||||
.keys = NULL, \
|
||||
.vals = NULL, \
|
||||
})
|
||||
#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 <file> Recover crashed session\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(_(" -o[N] Open N windows (default: one for each file)\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. */
|
||||
if (c < 0)
|
||||
return posp;
|
||||
if (c > '~') /* check for islower()/isupper() */
|
||||
;
|
||||
else if (c == '\'' || c == '`') { /* previous context mark */
|
||||
pos_copy = curwin->w_pcmark; /* need to make a copy because */
|
||||
posp = &pos_copy; /* w_pcmark may be changed soon */
|
||||
} else if (c == '"') /* to pos when leaving buffer */
|
||||
if (c > '~') { // check for islower()/isupper()
|
||||
} else if (c == '\'' || c == '`') { // previous context mark
|
||||
pos_copy = curwin->w_pcmark; // need to make a copy because
|
||||
posp = &pos_copy; // w_pcmark may be changed soon
|
||||
} else if (c == '"') { // to pos when leaving buffer
|
||||
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);
|
||||
else if (c == '.') /* to where last change was made */
|
||||
} else if (c == '.') { // to where last change was made
|
||||
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);
|
||||
else if (c == ']') /* to end of previous operator */
|
||||
} else if (c == ']') { // to end of previous operator
|
||||
posp = &(buf->b_op_end);
|
||||
else if (c == '{' || c == '}') { /* to previous/next paragraph */
|
||||
} else if (c == '{' || c == '}') { // to previous/next paragraph
|
||||
pos_T pos;
|
||||
oparg_T oa;
|
||||
int slcb = listcmd_busy;
|
||||
@@ -620,9 +619,9 @@ void do_marks(exarg_T *eap)
|
||||
if (arg != NULL && *arg == NUL)
|
||||
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)
|
||||
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) {
|
||||
if (namedfm[i].fmark.fnum != 0)
|
||||
name = fm_getname(&namedfm[i].fmark, 15);
|
||||
@@ -636,14 +635,14 @@ void do_marks(exarg_T *eap)
|
||||
xfree(name);
|
||||
}
|
||||
}
|
||||
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_end, 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_visual.vi_start, NULL, TRUE);
|
||||
show_one_mark('>', arg, &curbuf->b_visual.vi_end, NULL, TRUE);
|
||||
show_one_mark(-1, arg, NULL, NULL, FALSE);
|
||||
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_end, 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_visual.vi_start, NULL, true);
|
||||
show_one_mark('>', arg, &curbuf->b_visual.vi_end, NULL, true);
|
||||
show_one_mark(-1, arg, NULL, NULL, false);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -737,13 +736,14 @@ void ex_delmarks(exarg_T *eap)
|
||||
from = to = *p;
|
||||
|
||||
for (i = from; i <= to; ++i) {
|
||||
if (lower)
|
||||
if (lower) {
|
||||
curbuf->b_namedm[i - 'a'].mark.lnum = 0;
|
||||
else {
|
||||
if (digit)
|
||||
} else {
|
||||
if (digit) {
|
||||
n = i - '0' + NMARKS;
|
||||
else
|
||||
} else {
|
||||
n = i - 'A';
|
||||
}
|
||||
namedfm[n].fmark.mark.lnum = 0;
|
||||
xfree(namedfm[n].fname);
|
||||
namedfm[n].fname = NULL;
|
||||
@@ -1127,10 +1127,10 @@ void cleanup_jumplist(void)
|
||||
&& curwin->w_jumplist[i].fmark.mark.lnum
|
||||
== curwin->w_jumplist[from].fmark.mark.lnum)
|
||||
break;
|
||||
if (i >= curwin->w_jumplistlen) { // no duplicate
|
||||
if (i >= curwin->w_jumplistlen) { // no duplicate
|
||||
if (to != from) {
|
||||
// Not using curwin->w_jumplist[to++] = curwin->w_jumplist[from] because
|
||||
// this way valgrind complains about overlapping source and destination
|
||||
// Not using curwin->w_jumplist[to++] = curwin->w_jumplist[from] because
|
||||
// this way valgrind complains about overlapping source and destination
|
||||
// in memcpy() call. (clang-3.6.0, debug build with -DEXITFREE).
|
||||
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
|
||||
///
|
||||
/// @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.
|
||||
///
|
||||
/// @param[in] iter Iterator. Pass NULL to start iteration.
|
||||
/// @param[in] win Window for which jump list is processed.
|
||||
/// @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.
|
||||
const void *mark_jumplist_iter(const void *const iter, const win_T *const win,
|
||||
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
|
||||
///
|
||||
/// @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.
|
||||
///
|
||||
/// @param[in] iter Iterator. Pass NULL to start iteration.
|
||||
/// @param[out] name Mark name.
|
||||
/// @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.
|
||||
const void *mark_global_iter(const void *const iter, char *const name,
|
||||
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
|
||||
///
|
||||
/// @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.
|
||||
///
|
||||
/// Current mark name must either be NUL, '"', '^',
|
||||
/// '.' or 'a' .. 'z'. If it is neither of these
|
||||
/// Current mark name must either be NUL, '"', '^',
|
||||
/// '.' or 'a' .. 'z'. If it is neither of these
|
||||
/// behaviour is undefined.
|
||||
///
|
||||
/// @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
|
||||
///
|
||||
/// @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.
|
||||
///
|
||||
/// @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] 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.
|
||||
const void *mark_buffer_iter(const void *const iter, const buf_T *const buf,
|
||||
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] 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.
|
||||
///
|
||||
/// @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] buf Pointer to the buffer to set mark in.
|
||||
/// @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.
|
||||
///
|
||||
/// @return true on success, false on failure.
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
/// 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.
|
||||
#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->additional_data = NULL;
|
||||
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.
|
||||
|
||||
int i = 0;
|
||||
@@ -5327,7 +5327,7 @@ static inline bool reg_empty(const yankreg_T *const reg)
|
||||
/// @param[out] name Register name.
|
||||
/// @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.
|
||||
const void *op_register_iter(const void *const iter, char *const name,
|
||||
yankreg_T *const reg)
|
||||
|
@@ -2441,9 +2441,8 @@ did_set_string_option (
|
||||
verbose_stop();
|
||||
if (*p_vfile != NUL && verbose_open() == FAIL)
|
||||
errmsg = e_invarg;
|
||||
}
|
||||
/* 'shada' */
|
||||
else if (varp == &p_shada) {
|
||||
} else if (varp == &p_shada) {
|
||||
for (s = p_shada; *s; ) {
|
||||
/* Check it's a valid character */
|
||||
if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL) {
|
||||
|
@@ -4633,7 +4633,7 @@ void set_substitute_pattern(const SearchPattern pat)
|
||||
|
||||
/// 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.
|
||||
void set_last_used_pattern(const bool is_substitute_pattern)
|
||||
{
|
||||
|
@@ -44,7 +44,7 @@
|
||||
|
||||
/// 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.
|
||||
typedef struct soffset {
|
||||
char dir; ///< Search direction: forward ('/') or backward ('?')
|
||||
|
Reference in New Issue
Block a user