summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-04 21:57:43 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-04 21:57:43 +0100
commit4ba37b5833de99db9e9afe8928b31c864182405c (patch)
tree30662897c6ff3d608e47d22f8bab9ce8703b26e7 /src
parent2ab2e8608f9b2c85432715bb9a7f226fdbf8cd35 (diff)
patch 8.1.2388: using old C style commentsv8.1.2388
Problem: Using old C style comments. Solution: Use // comments where appropriate.
Diffstat (limited to 'src')
-rw-r--r--src/json.c86
-rw-r--r--src/json_test.c22
-rw-r--r--src/kword_test.c6
-rw-r--r--src/list.c156
-rw-r--r--src/main.c925
-rw-r--r--src/mark.c210
-rw-r--r--src/mbyte.c1030
-rw-r--r--src/memfile.c198
-rw-r--r--src/memfile_test.c24
-rw-r--r--src/memline.c877
-rw-r--r--src/menu.c320
-rw-r--r--src/version.c2
12 files changed, 1926 insertions, 1930 deletions
diff --git a/src/json.c b/src/json.c
index cca6f7044f..eedb6062af 100644
--- a/src/json.c
+++ b/src/json.c
@@ -48,7 +48,7 @@ json_encode(typval_T *val, int options)
{
garray_T ga;
- /* Store bytes in the growarray. */
+ // Store bytes in the growarray.
ga_init2(&ga, 1, 4000);
json_encode_gap(&ga, val, options);
ga_append(&ga, NUL);
@@ -104,8 +104,8 @@ write_string(garray_T *gap, char_u *str)
if (!enc_utf8)
{
- /* Convert the text from 'encoding' to utf-8, the JSON string is
- * always utf-8. */
+ // Convert the text from 'encoding' to utf-8, the JSON string is
+ // always utf-8.
conv.vc_type = CONV_NONE;
convert_setup(&conv, p_enc, (char_u*)"utf-8");
if (conv.vc_type != CONV_NONE)
@@ -117,7 +117,7 @@ write_string(garray_T *gap, char_u *str)
while (*res != NUL)
{
int c;
- /* always use utf-8 encoding, ignore 'encoding' */
+ // always use utf-8 encoding, ignore 'encoding'
c = utf_ptr2char(res);
switch (c)
@@ -132,8 +132,8 @@ write_string(garray_T *gap, char_u *str)
ga_append(gap, '\\'); ga_append(gap, 'f'); break;
case 0x0d:
ga_append(gap, '\\'); ga_append(gap, 'r'); break;
- case 0x22: /* " */
- case 0x5c: /* \ */
+ case 0x22: // "
+ case 0x5c: // backslash
ga_append(gap, '\\');
ga_append(gap, c);
break;
@@ -200,9 +200,9 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID, int options)
case VVAL_TRUE: ga_concat(gap, (char_u *)"true"); break;
case VVAL_NONE: if ((options & JSON_JS) != 0
&& (options & JSON_NO_NONE) == 0)
- /* empty item */
+ // empty item
break;
- /* FALLTHROUGH */
+ // FALLTHROUGH
case VVAL_NULL: ga_concat(gap, (char_u *)"null"); break;
}
break;
@@ -222,7 +222,7 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID, int options)
case VAR_PARTIAL:
case VAR_JOB:
case VAR_CHANNEL:
- /* no JSON equivalent TODO: better error */
+ // no JSON equivalent TODO: better error
emsg(_(e_invarg));
return FAIL;
@@ -268,7 +268,7 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID, int options)
&& li->li_next == NULL
&& li->li_tv.v_type == VAR_SPECIAL
&& li->li_tv.vval.v_number == VVAL_NONE)
- /* add an extra comma if the last item is v:none */
+ // add an extra comma if the last item is v:none
ga_append(gap, ',');
li = li->li_next;
if (li != NULL)
@@ -405,21 +405,21 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote)
if (res != NULL)
ga_init2(&ga, 1, 200);
- p = reader->js_buf + reader->js_used + 1; /* skip over " or ' */
+ p = reader->js_buf + reader->js_used + 1; // skip over " or '
while (*p != quote)
{
- /* The JSON is always expected to be utf-8, thus use utf functions
- * here. The string is converted below if needed. */
+ // The JSON is always expected to be utf-8, thus use utf functions
+ // here. The string is converted below if needed.
if (*p == NUL || p[1] == NUL || utf_ptr2len(p) < utf_byte2len(*p))
{
- /* Not enough bytes to make a character or end of the string. Get
- * more if possible. */
+ // Not enough bytes to make a character or end of the string. Get
+ // more if possible.
if (reader->js_fill == NULL)
break;
len = (int)(reader->js_end - p);
reader->js_used = (int)(p - reader->js_buf);
if (!reader->js_fill(reader))
- break; /* didn't get more */
+ break; // didn't get more
p = reader->js_buf + reader->js_used;
reader->js_end = reader->js_buf + STRLEN(reader->js_buf);
continue;
@@ -466,7 +466,7 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote)
{
varnumber_T nr2 = 0;
- /* decode surrogate pair: \ud812\u3456 */
+ // decode surrogate pair: \ud812\u3456
len = 0;
vim_str2nr(p + 2, NULL, &len,
STR2NR_HEX + STR2NR_FORCE, &nr2, NULL, 4, TRUE);
@@ -492,7 +492,7 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote)
}
break;
default:
- /* not a special char, skip over \ */
+ // not a special char, skip over backslash
++p;
continue;
}
@@ -533,7 +533,7 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote)
{
vimconv_T conv;
- /* Convert the utf-8 string to 'encoding'. */
+ // Convert the utf-8 string to 'encoding'.
conv.vc_type = CONV_NONE;
convert_setup(&conv, (char_u*)"utf-8", p_enc);
if (conv.vc_type != CONV_NONE)
@@ -560,14 +560,14 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote)
}
typedef enum {
- JSON_ARRAY, /* parsing items in an array */
- JSON_OBJECT_KEY, /* parsing key of an object */
- JSON_OBJECT /* parsing item in an object, after the key */
+ JSON_ARRAY, // parsing items in an array
+ JSON_OBJECT_KEY, // parsing key of an object
+ JSON_OBJECT // parsing item in an object, after the key
} json_decode_T;
typedef struct {
json_decode_T jd_type;
- typval_T jd_tv; /* the list or dict */
+ typval_T jd_tv; // the list or dict
typval_T jd_key_tv;
char_u *jd_key;
} json_dec_item_T;
@@ -611,17 +611,17 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
{
retval = MAYBE;
if (top_item->jd_type == JSON_OBJECT)
- /* did get the key, clear it */
+ // did get the key, clear it
clear_tv(&top_item->jd_key_tv);
goto theend;
}
if (top_item->jd_type == JSON_OBJECT_KEY
|| top_item->jd_type == JSON_ARRAY)
{
- /* Check for end of object or array. */
+ // Check for end of object or array.
if (*p == (top_item->jd_type == JSON_ARRAY ? ']' : '}'))
{
- ++reader->js_used; /* consume the ']' or '}' */
+ ++reader->js_used; // consume the ']' or '}'
--stack.ga_len;
if (stack.ga_len == 0)
{
@@ -644,7 +644,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
{
char_u *key;
- /* accept an object key that is not in quotes */
+ // accept an object key that is not in quotes
key = p = reader->js_buf + reader->js_used;
while (*p != NUL && *p != ':' && *p > ' ')
++p;
@@ -660,7 +660,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
{
switch (*p)
{
- case '[': /* start of array */
+ case '[': // start of array
if (top_item && top_item->jd_type == JSON_OBJECT_KEY)
{
retval = FAIL;
@@ -679,7 +679,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
break;
}
- ++reader->js_used; /* consume the '[' */
+ ++reader->js_used; // consume the '['
top_item = ((json_dec_item_T *)stack.ga_data)
+ stack.ga_len;
top_item->jd_type = JSON_ARRAY;
@@ -691,7 +691,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
}
continue;
- case '{': /* start of object */
+ case '{': // start of object
if (top_item && top_item->jd_type == JSON_OBJECT_KEY)
{
retval = FAIL;
@@ -710,7 +710,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
break;
}
- ++reader->js_used; /* consume the '{' */
+ ++reader->js_used; // consume the '{'
top_item = ((json_dec_item_T *)stack.ga_data)
+ stack.ga_len;
top_item->jd_type = JSON_OBJECT_KEY;
@@ -722,7 +722,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
}
continue;
- case '"': /* string */
+ case '"': // string
retval = json_decode_string(reader, cur_item, *p);
break;
@@ -736,15 +736,15 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
}
break;
- case ',': /* comma: empty item */
+ case ',': // comma: empty item
if ((options & JSON_JS) == 0)
{
emsg(_(e_invarg));
retval = FAIL;
break;
}
- /* FALLTHROUGH */
- case NUL: /* empty */
+ // FALLTHROUGH
+ case NUL: // empty
if (cur_item != NULL)
{
cur_item->v_type = VAR_SPECIAL;
@@ -795,7 +795,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
varnumber_T nr;
vim_str2nr(reader->js_buf + reader->js_used,
- NULL, &len, 0, /* what */
+ NULL, &len, 0, // what
&nr, NULL, 0, TRUE);
if (len == 0)
{
@@ -881,7 +881,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
break;
}
#endif
- /* check for truncated name */
+ // check for truncated name
len = (int)(reader->js_end - (reader->js_buf + reader->js_used));
if (
(len < 5 && STRNICMP((char *)p, "false", len) == 0)
@@ -899,8 +899,8 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
break;
}
- /* We are finished when retval is FAIL or MAYBE and when at the
- * toplevel. */
+ // We are finished when retval is FAIL or MAYBE and when at the
+ // toplevel.
if (retval == FAIL)
break;
if (retval == MAYBE || stack.ga_len == 0)
@@ -1037,7 +1037,7 @@ item_end:
}
}
- /* Get here when parsing failed. */
+ // Get here when parsing failed.
if (res != NULL)
{
clear_tv(res);
@@ -1061,7 +1061,7 @@ json_decode_all(js_read_T *reader, typval_T *res, int options)
{
int ret;
- /* We find the end once, to avoid calling strlen() many times. */
+ // We find the end once, to avoid calling strlen() many times.
reader->js_end = reader->js_buf + STRLEN(reader->js_buf);
json_skip_white(reader);
ret = json_decode_item(reader, res, options);
@@ -1093,7 +1093,7 @@ json_decode(js_read_T *reader, typval_T *res, int options)
{
int ret;
- /* We find the end once, to avoid calling strlen() many times. */
+ // We find the end once, to avoid calling strlen() many times.
reader->js_end = reader->js_buf + STRLEN(reader->js_buf);
json_skip_white(reader);
ret = json_decode_item(reader, res, options);
@@ -1119,7 +1119,7 @@ json_find_end(js_read_T *reader, int options)
int used_save = reader->js_used;
int ret;
- /* We find the end once, to avoid calling strlen() many times. */
+ // We find the end once, to avoid calling strlen() many times.
reader->js_end = reader->js_buf + STRLEN(reader->js_buf);
json_skip_white(reader);
ret = json_decode_item(reader, NULL, options);
diff --git a/src/json_test.c b/src/json_test.c
index 47bec8ee65..5fb772ee05 100644
--- a/src/json_test.c
+++ b/src/json_test.c
@@ -14,16 +14,16 @@
#undef NDEBUG
#include <assert.h>
-/* Must include main.c because it contains much more than just main() */
+// Must include main.c because it contains much more than just main()
#define NO_VIM_MAIN
#include "main.c"
-/* This file has to be included because the tested functions are static */
+// This file has to be included because the tested functions are static
#include "json.c"
#if defined(FEAT_EVAL)
/*
- * Test json_find_end() with imcomplete items.
+ * Test json_find_end() with incomplete items.
*/
static void
test_decode_find_end(void)
@@ -33,7 +33,7 @@ test_decode_find_end(void)
reader.js_fill = NULL;
reader.js_used = 0;
- /* string and incomplete string */
+ // string and incomplete string
reader.js_buf = (char_u *)"\"hello\"";
assert(json_find_end(&reader, 0) == OK);
reader.js_buf = (char_u *)" \"hello\" ";
@@ -41,13 +41,13 @@ test_decode_find_end(void)
reader.js_buf = (char_u *)"\"hello";
assert(json_find_end(&reader, 0) == MAYBE);
- /* number and dash (incomplete number) */
+ // number and dash (incomplete number)
reader.js_buf = (char_u *)"123";
assert(json_find_end(&reader, 0) == OK);
reader.js_buf = (char_u *)"-";
assert(json_find_end(&reader, 0) == MAYBE);
- /* false, true and null, also incomplete */
+ // false, true and null, also incomplete
reader.js_buf = (char_u *)"false";
assert(json_find_end(&reader, 0) == OK);
reader.js_buf = (char_u *)"f";
@@ -77,7 +77,7 @@ test_decode_find_end(void)
reader.js_buf = (char_u *)"nul";
assert(json_find_end(&reader, 0) == MAYBE);
- /* object without white space */
+ // object without white space
reader.js_buf = (char_u *)"{\"a\":123}";
assert(json_find_end(&reader, 0) == OK);
reader.js_buf = (char_u *)"{\"a\":123";
@@ -93,7 +93,7 @@ test_decode_find_end(void)
reader.js_buf = (char_u *)"{";
assert(json_find_end(&reader, 0) == MAYBE);
- /* object with white space */
+ // object with white space
reader.js_buf = (char_u *)" { \"a\" : 123 } ";
assert(json_find_end(&reader, 0) == OK);
reader.js_buf = (char_u *)" { \"a\" : 123 ";
@@ -107,13 +107,13 @@ test_decode_find_end(void)
reader.js_buf = (char_u *)" { ";
assert(json_find_end(&reader, 0) == MAYBE);
- /* JS object with white space */
+ // JS object with white space
reader.js_buf = (char_u *)" { a : 123 } ";
assert(json_find_end(&reader, JSON_JS) == OK);
reader.js_buf = (char_u *)" { a : ";
assert(json_find_end(&reader, JSON_JS) == MAYBE);
- /* array without white space */
+ // array without white space
reader.js_buf = (char_u *)"[\"a\",123]";
assert(json_find_end(&reader, 0) == OK);
reader.js_buf = (char_u *)"[\"a\",123";
@@ -129,7 +129,7 @@ test_decode_find_end(void)
reader.js_buf = (char_u *)"[";
assert(json_find_end(&reader, 0) == MAYBE);
- /* array with white space */
+ // array with white space
reader.js_buf = (char_u *)" [ \"a\" , 123 ] ";
assert(json_find_end(&reader, 0) == OK);
reader.js_buf = (char_u *)" [ \"a\" , 123 ";
diff --git a/src/kword_test.c b/src/kword_test.c
index 927c4fd0cd..c02ba4312c 100644
--- a/src/kword_test.c
+++ b/src/kword_test.c
@@ -14,11 +14,11 @@
#undef NDEBUG
#include <assert.h>
-/* Must include main.c because it contains much more than just main() */
+// Must include main.c because it contains much more than just main()
#define NO_VIM_MAIN
#include "main.c"
-/* This file has to be included because the tested functions are static */
+// This file has to be included because the tested functions are static
#include "charset.c"
/*
@@ -38,7 +38,7 @@ test_isword_funcs_utf8(void)
buf.b_p_isk = (char_u *)"@,48-57,_,128-167,224-235";
curbuf = &buf;
- mb_init(); /* calls init_chartab() */
+ mb_init(); // calls init_chartab()
for (c = 0; c < 0x10000; ++c)
{
diff --git a/src/list.c b/src/list.c
index 3038b22f93..6f475fcef0 100644
--- a/src/list.c
+++ b/src/list.c
@@ -17,8 +17,8 @@
static char *e_listblobarg = N_("E899: Argument of %s must be a List or Blob");
-/* List heads for garbage collection. */
-static list_T *first_list = NULL; /* list of all lists */
+// List heads for garbage collection.
+static list_T *first_list = NULL; // list of all lists
/*
* Add a watcher to a list.
@@ -77,7 +77,7 @@ list_alloc(void)
l = ALLOC_CLEAR_ONE(list_T);
if (l != NULL)
{
- /* Prepend the list to the list of lists for garbage collection. */
+ // Prepend the list to the list of lists for garbage collection.
if (first_list != NULL)
first_list->lv_used_prev = l;
l->lv_used_prev = NULL;
@@ -165,7 +165,7 @@ list_free_contents(list_T *l)
for (item = l->lv_first; item != NULL; item = l->lv_first)
{
- /* Remove the item before deleting it. */
+ // Remove the item before deleting it.
l->lv_first = item->li_next;
clear_tv(&item->li_tv);
vim_free(item);
@@ -187,9 +187,9 @@ list_free_nonref(int copyID)
if ((ll->lv_copyID & COPYID_MASK) != (copyID & COPYID_MASK)
&& ll->lv_watch == NULL)
{
- /* Free the List and ordinary items it contains, but don't recurse
- * into Lists and Dictionaries, they will be in the list of dicts
- * or list of lists. */
+ // Free the List and ordinary items it contains, but don't recurse
+ // into Lists and Dictionaries, they will be in the list of dicts
+ // or list of lists.
list_free_contents(ll);
did_free = TRUE;
}
@@ -199,7 +199,7 @@ list_free_nonref(int copyID)
static void
list_free_list(list_T *l)
{
- /* Remove the list from the list of lists for garbage collection. */
+ // Remove the list from the list of lists for garbage collection.
if (l->lv_used_prev == NULL)
first_list = l->lv_used_next;
else
@@ -221,9 +221,9 @@ list_free_items(int copyID)
if ((ll->lv_copyID & COPYID_MASK) != (copyID & COPYID_MASK)
&& ll->lv_watch == NULL)
{
- /* Free the List and ordinary items it contains, but don't recurse
- * into Lists and Dictionaries, they will be in the list of dicts
- * or list of lists. */
+ // Free the List and ordinary items it contains, but don't recurse
+ // into Lists and Dictionaries, they will be in the list of dicts
+ // or list of lists.
list_free_list(ll);
}
}
@@ -287,8 +287,8 @@ list_len(list_T *l)
list_equal(
list_T *l1,
list_T *l2,
- int ic, /* ignore case for strings */
- int recursive) /* TRUE when used recursively */
+ int ic, // ignore case for strings
+ int recursive) // TRUE when used recursively
{
listitem_T *item1, *item2;
@@ -321,32 +321,32 @@ list_find(list_T *l, long n)
if (l == NULL)
return NULL;
- /* Negative index is relative to the end. */
+ // Negative index is relative to the end.
if (n < 0)
n = l->lv_len + n;
- /* Check for index out of range. */
+ // Check for index out of range.
if (n < 0 || n >= l->lv_len)
return NULL;
- /* When there is a cached index may start search from there. */
+ // When there is a cached index may start search from there.
if (l->lv_idx_item != NULL)
{
if (n < l->lv_idx / 2)
{
- /* closest to the start of the list */
+ // closest to the start of the list
item = l->lv_first;
idx = 0;
}
else if (n > (l->lv_idx + l->lv_len) / 2)
{
- /* closest to the end of the list */
+ // closest to the end of the list
item = l->lv_last;
idx = l->lv_len - 1;
}
else
{
- /* closest to the cached index */
+ // closest to the cached index
item = l->lv_idx_item;
idx = l->lv_idx;
}
@@ -355,13 +355,13 @@ list_find(list_T *l, long n)
{
if (n < l->lv_len / 2)
{
- /* closest to the start of the list */
+ // closest to the start of the list
item = l->lv_first;
idx = 0;
}
else
{
- /* closest to the end of the list */
+ // closest to the end of the list
item = l->lv_last;
idx = l->lv_len - 1;
}
@@ -369,18 +369,18 @@ list_find(list_T *l, long n)
while (n > idx)
{
- /* search forward */
+ // search forward
item = item->li_next;
++idx;
}
while (n < idx)
{
- /* search backward */
+ // search backward
item = item->li_prev;
--idx;
}
- /* cache the used index */
+ // cache the used index
l->lv_idx = idx;
l->lv_idx_item = item;
@@ -394,7 +394,7 @@ list_find(list_T *l, long n)
list_find_nr(
list_T *l,
long idx,
- int *errorp) /* set to TRUE when something wrong */
+ int *errorp) // set to TRUE when something wrong
{
listitem_T *li;
@@ -453,7 +453,7 @@ list_append(list_T *l, listitem_T *item)
{
if (l->lv_last == NULL)
{
- /* empty list */
+ // empty list
l->lv_first = item;
l->lv_last = item;
item->li_prev = NULL;
@@ -585,11 +585,11 @@ list_insert_tv(list_T *l, typval_T *tv, listitem_T *item)
list_insert(list_T *l, listitem_T *ni, listitem_T *item)
{
if (item == NULL)
- /* Append new item at end of list. */
+ // Append new item at end of list.
list_append(l, ni);
else
{
- /* Insert new item before existing item. */
+ // Insert new item before existing item.
ni->li_prev = item->li_prev;
ni->li_next = item;
if (item->li_prev == NULL)
@@ -618,8 +618,8 @@ list_extend(list_T *l1, list_T *l2, listitem_T *bef)
listitem_T *item;
int todo = l2->lv_len;
- /* We also quit the loop when we have inserted the original item count of
- * the list, avoid a hang when we extend a list with itself. */
+ // We also quit the loop when we have inserted the original item count of
+ // the list, avoid a hang when we extend a list with itself.
for (item = l2->lv_first; item != NULL && --todo >= 0; item = item->li_next)
if (list_insert_tv(l1, &item->li_tv, bef) == FAIL)
return FAIL;
@@ -638,14 +638,14 @@ list_concat(list_T *l1, list_T *l2, typval_T *tv)
if (l1 == NULL || l2 == NULL)
return FAIL;
- /* make a copy of the first list. */
+ // make a copy of the first list.
l = list_copy(l1, FALSE, 0);
if (l == NULL)
return FAIL;
tv->v_type = VAR_LIST;
tv->vval.v_list = l;
- /* append all items from the second list */
+ // append all items from the second list
return list_extend(l, l2, NULL);
}
@@ -670,8 +670,8 @@ list_copy(list_T *orig, int deep, int copyID)
{
if (copyID != 0)
{
- /* Do this before adding the items, because one of the items may
- * refer back to this list. */
+ // Do this before adding the items, because one of the items may
+ // refer back to this list.
orig->lv_copyID = copyID;
orig->lv_copylist = copy;
}
@@ -715,7 +715,7 @@ vimlist_remove(list_T *l, listitem_T *item, listitem_T *item2)
{
listitem_T *ip;
- /* notify watchers */
+ // notify watchers
for (ip = item; ip != NULL; ip = ip->li_next)
{
--l->lv_len;
@@ -766,13 +766,13 @@ typedef struct join_S {
static int
list_join_inner(
- garray_T *gap, /* to store the result in */
+ garray_T *gap, // to store the result in
list_T *l,
char_u *sep,
int echo_style,
int restore_copyID,
int copyID,
- garray_T *join_gap) /* to keep each list item string */
+ garray_T *join_gap) // to keep each list item string
{
int i;
join_T *p;
@@ -784,7 +784,7 @@ list_join_inner(
listitem_T *item;
char_u *s;
- /* Stringify each item in the list. */
+ // Stringify each item in the list.
for (item = l->lv_first; item != NULL && !got_int; item = item->li_next)
{
s = echo_string_core(&item->li_tv, &tofree, numbuf, copyID,
@@ -809,12 +809,12 @@ list_join_inner(
}
line_breakcheck();
- if (did_echo_string_emsg) /* recursion error, bail out */
+ if (did_echo_string_emsg) // recursion error, bail out
break;
}
- /* Allocate result buffer with its total size, avoid re-allocation and
- * multiple copy operations. Add 2 for a tailing ']' and NUL. */
+ // Allocate result buffer with its total size, avoid re-allocation and
+ // multiple copy operations. Add 2 for a tailing ']' and NUL.
if (join_gap->ga_len >= 2)
sumlen += (int)STRLEN(sep) * (join_gap->ga_len - 1);
if (ga_grow(gap, sumlen + 2) == FAIL)
@@ -856,12 +856,12 @@ list_join(
int i;
if (l->lv_len < 1)
- return OK; /* nothing to do */
+ return OK; // nothing to do
ga_init2(&join_ga, (int)sizeof(join_T), l->lv_len);
retval = list_join_inner(gap, l, sep, echo_style, restore_copyID,
copyID, &join_ga);
- /* Dispose each item in join_ga. */
+ // Dispose each item in join_ga.
if (join_ga.ga_data != NULL)
{
p = (join_T *)join_ga.ga_data;
@@ -931,7 +931,7 @@ get_list_tv(char_u **arg, typval_T *rettv, int evaluate)
*arg = skipwhite(*arg + 1);
while (**arg != ']' && **arg != NUL)
{
- if (eval1(arg, &tv, evaluate) == FAIL) /* recursive! */
+ if (eval1(arg, &tv, evaluate) == FAIL) // recursive!
goto failret;
if (evaluate)
{
@@ -1120,7 +1120,7 @@ list_remove(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg)
{
if (argvars[2].v_type == VAR_UNKNOWN)
{
- /* Remove one item, return its value. */
+ // Remove one item, return its value.
vimlist_remove(l, item, item);
*rettv = item->li_tv;
vim_free(item);
@@ -1144,7 +1144,7 @@ list_remove(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg)
if (li == item2)
break;
}
- if (li == NULL) /* didn't find "item2" after "item" */
+ if (li == NULL) // didn't find "item2" after "item"
emsg(_(e_invrange));
else
{
@@ -1167,14 +1167,14 @@ list_remove(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg)
static int item_compare(const void *s1, const void *s2);
static int item_compare2(const void *s1, const void *s2);
-/* struct used in the array that's given to qsort() */
+// struct used in the array that's given to qsort()
typedef struct
{
listitem_T *item;
int idx;
} sortItem_T;
-/* struct storing information about current sort */
+// struct storing information about current sort
typedef struct
{
int item_compare_ic;
@@ -1229,9 +1229,9 @@ item_compare(const void *s1, const void *s2)
}
#endif
- /* tv2string() puts quotes around a string and allocates memory. Don't do
- * that for string variables. Use a single quote when comparing with a
- * non-string to do what the docs promise. */
+ // tv2string() puts quotes around a string and allocates memory. Don't do
+ // that for string variables. Use a single quote when comparing with a
+ // non-string to do what the docs promise.
if (tv1->v_type == VAR_STRING)
{
if (tv2->v_type != VAR_STRING || sortinfo->item_compare_numeric)
@@ -1269,8 +1269,8 @@ item_compare(const void *s1, const void *s2)
res = n1 == n2 ? 0 : n1 > n2 ? 1 : -1;
}
- /* When the result would be zero, compare the item indexes. Makes the
- * sort stable. */
+ // When the result would be zero, compare the item indexes. Makes the
+ // sort stable.
if (res == 0 && !sortinfo->item_compare_keep_zero)
res = si1->idx > si2->idx ? 1 : -1;
@@ -1290,7 +1290,7 @@ item_compare2(const void *s1, const void *s2)
partial_T *partial = sortinfo->item_compare_partial;
funcexe_T funcexe;
- /* shortcut after failure in previous call; compare all items equal */
+ // shortcut after failure in previous call; compare all items equal
if (sortinfo->item_compare_func_err)
return 0;
@@ -1302,12 +1302,12 @@ item_compare2(const void *s1, const void *s2)
else
func_name = partial_name(partial);
- /* Copy the values. This is needed to be able to set v_lock to VAR_FIXED
- * in the copy without changing the original list items. */
+ // Copy the values. This is needed to be able to set v_lock to VAR_FIXED
+ // in the copy without changing the original list items.
copy_tv(&si1->item->li_tv, &argv[0]);
copy_tv(&si2->item->li_tv, &argv[1]);
- rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */
+ rettv.v_type = VAR_UNKNOWN; // clear_tv() uses this
vim_memset(&funcexe, 0, sizeof(funcexe));
funcexe.evaluate = TRUE;
funcexe.partial = partial;
@@ -1321,11 +1321,11 @@ item_compare2(const void *s1, const void *s2)
else
res = (int)tv_get_number_chk(&rettv, &sortinfo->item_compare_func_err);
if (sortinfo->item_compare_func_err)
- res = ITEM_COMPARE_FAIL; /* return value has wrong type */
+ res = ITEM_COMPARE_FAIL; // return value has wrong type
clear_tv(&rettv);
- /* When the result would be zero, compare the pointers themselves. Makes
- * the sort stable. */
+ // When the result would be zero, compare the pointers themselves. Makes
+ // the sort stable.
if (res == 0 && !sortinfo->item_compare_keep_zero)
res = si1->idx > si2->idx ? 1 : -1;
@@ -1346,8 +1346,8 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
long len;
long i;
- /* Pointer to current info struct used in compare function. Save and
- * restore the current one for nested calls. */
+ // Pointer to current info struct used in compare function. Save and
+ // restore the current one for nested calls.
old_sortinfo = sortinfo;
sortinfo = &info;
@@ -1364,7 +1364,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
len = list_len(l);
if (len <= 1)
- goto theend; /* short list sorts pretty quickly */
+ goto theend; // short list sorts pretty quickly
info.item_compare_ic = FALSE;
info.item_compare_numeric = FALSE;
@@ -1377,7 +1377,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
info.item_compare_selfdict = NULL;
if (argvars[1].v_type != VAR_UNKNOWN)
{
- /* optional second argument: {func} */
+ // optional second argument: {func}
if (argvars[1].v_type == VAR_FUNC)
info.item_compare_func = argvars[1].vval.v_string;
else if (argvars[1].v_type == VAR_PARTIAL)
@@ -1388,7 +1388,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
i = (long)tv_get_number_chk(&argvars[1], &error);
if (error)
- goto theend; /* type error; errmsg already given */
+ goto theend; // type error; errmsg already given
if (i == 1)
info.item_compare_ic = TRUE;
else if (argvars[1].v_type != VAR_NUMBER)
@@ -1402,7 +1402,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
{
if (*info.item_compare_func == NUL)
{
- /* empty string means default sort */
+ // empty string means default sort
info.item_compare_func = NULL;
}
else if (STRCMP(info.item_compare_func, "n") == 0)
@@ -1432,7 +1432,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
if (argvars[2].v_type != VAR_UNKNOWN)
{
- /* optional third argument: {dict} */
+ // optional third argument: {dict}
if (argvars[2].v_type != VAR_DICT)
{
emsg(_(e_dictreq));
@@ -1442,7 +1442,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
}
}
- /* Make an array with each entry pointing to an item in the List. */
+ // Make an array with each entry pointing to an item in the List.
ptrs = ALLOC_MULT(sortItem_T, len);
if (ptrs == NULL)
goto theend;
@@ -1450,7 +1450,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
i = 0;
if (sort)
{
- /* sort(): ptrs will be the list to sort */
+ // sort(): ptrs will be the list to sort
for (li = l->lv_first; li != NULL; li = li->li_next)
{
ptrs[i].item = li;
@@ -1460,7 +1460,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
info.item_compare_func_err = FALSE;
info.item_compare_keep_zero = FALSE;
- /* test the compare function */
+ // test the compare function
if ((info.item_compare_func != NULL
|| info.item_compare_partial != NULL)
&& item_compare2((void *)&ptrs[0], (void *)&ptrs[1])
@@ -1468,7 +1468,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
emsg(_("E702: Sort compare function failed"));
else
{
- /* Sort the array with item pointers. */
+ // Sort the array with item pointers.
qsort((void *)ptrs, (size_t)len, sizeof(sortItem_T),
info.item_compare_func == NULL
&& info.item_compare_partial == NULL
@@ -1476,7 +1476,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
if (!info.item_compare_func_err)
{
- /* Clear the List and append the items in sorted order. */
+ // Clear the List and append the items in sorted order.
l->lv_first = l->lv_last = l->lv_idx_item = NULL;
l->lv_len = 0;
for (i = 0; i < len; ++i)
@@ -1488,7 +1488,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort)
{
int (*item_compare_func_ptr)(const void *, const void *);
- /* f_uniq(): ptrs will be a stack of items to remove */
+ // f_uniq(): ptrs will be a stack of items to remove
info.item_compare_func_err = FALSE;
info.item_compare_keep_zero = TRUE;
item_compare_func_ptr = info.item_compare_func != NULL
@@ -1774,7 +1774,7 @@ f_add(typval_T *argvars, typval_T *rettv)
list_T *l;
blob_T *b;
- rettv->vval.v_number = 1; /* Default: Failed */
+ rettv->vval.v_number = 1; // Default: Failed
if (argvars[0].v_type == VAR_LIST)
{
if ((l = argvars[0].vval.v_list) != NULL
@@ -1935,7 +1935,7 @@ f_extend(typval_T *argvars, typval_T *rettv)
{
before = (long)tv_get_number_chk(&argvar