aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/undo.c
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2023-01-18 14:17:11 +0100
committerGitHub <noreply@github.com>2023-01-18 21:17:11 +0800
commit8a4285d5637c146a0ae606918a8e77063c6a5f0d (patch)
tree4cf13b388ec19fcded4be0648dd75eeea506baf1 /src/nvim/undo.c
parent2c1e7242f9bed345e520e9060e5e13fe48a023eb (diff)
downloadrneovim-8a4285d5637c146a0ae606918a8e77063c6a5f0d.tar.gz
rneovim-8a4285d5637c146a0ae606918a8e77063c6a5f0d.tar.bz2
rneovim-8a4285d5637c146a0ae606918a8e77063c6a5f0d.zip
refactor: replace char_u with char 24 (#21823)
refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459
Diffstat (limited to 'src/nvim/undo.c')
-rw-r--r--src/nvim/undo.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 3e4aae62c9..ad16a6eda2 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -1074,9 +1074,9 @@ static u_entry_T *unserialize_uep(bufinfo_T *bi, bool *error, const char *file_n
char_u **array = NULL;
if (uep->ue_size > 0) {
- if ((size_t)uep->ue_size < SIZE_MAX / sizeof(char_u *)) { // -V547
- array = xmalloc(sizeof(char_u *) * (size_t)uep->ue_size);
- memset(array, 0, sizeof(char_u *) * (size_t)uep->ue_size);
+ if ((size_t)uep->ue_size < SIZE_MAX / sizeof(char *)) { // -V547
+ array = xmalloc(sizeof(char *) * (size_t)uep->ue_size);
+ memset(array, 0, sizeof(char *) * (size_t)uep->ue_size);
}
}
uep->ue_array = (char **)array;
@@ -1209,7 +1209,7 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf,
}
goto theend;
} else {
- char_u mbuf[UF_START_MAGIC_LEN];
+ char mbuf[UF_START_MAGIC_LEN];
ssize_t len = read_eintr(fd, mbuf, UF_START_MAGIC_LEN);
close(fd);
if (len < UF_START_MAGIC_LEN
@@ -1342,8 +1342,8 @@ write_error:
#ifdef HAVE_ACL
if (buf->b_ffname != NULL) {
// For systems that support ACL: get the ACL from the original file.
- vim_acl_T acl = os_get_acl((char_u *)buf->b_ffname);
- os_set_acl((char_u *)file_name, acl);
+ vim_acl_T acl = os_get_acl(buf->b_ffname);
+ os_set_acl(file_name, acl);
os_free_acl(acl);
}
#endif
@@ -1363,7 +1363,7 @@ void u_read_undo(char *name, const char_u *hash, const char *orig_name FUNC_ATTR
FUNC_ATTR_NONNULL_ARG(2)
{
u_header_T **uhp_table = NULL;
- char_u *line_ptr = NULL;
+ char *line_ptr = NULL;
char *file_name;
if (name == NULL) {
@@ -1414,7 +1414,7 @@ void u_read_undo(char *name, const char_u *hash, const char *orig_name FUNC_ATTR
};
// Read the undo file header.
- char_u magic_buf[UF_START_MAGIC_LEN];
+ char magic_buf[UF_START_MAGIC_LEN];
if (fread(magic_buf, UF_START_MAGIC_LEN, 1, fp) != 1
|| memcmp(magic_buf, UF_START_MAGIC, UF_START_MAGIC_LEN) != 0) {
semsg(_("E823: Not an undo file: %s"), file_name);
@@ -1426,8 +1426,8 @@ void u_read_undo(char *name, const char_u *hash, const char *orig_name FUNC_ATTR
goto error;
}
- char_u read_hash[UNDO_HASH_SIZE];
- if (!undo_read(&bi, read_hash, UNDO_HASH_SIZE)) {
+ char read_hash[UNDO_HASH_SIZE];
+ if (!undo_read(&bi, (char_u *)read_hash, UNDO_HASH_SIZE)) {
corruption_error("hash", file_name);
goto error;
}
@@ -1453,7 +1453,7 @@ void u_read_undo(char *name, const char_u *hash, const char *orig_name FUNC_ATTR
}
if (str_len > 0) {
- line_ptr = undo_read_string(&bi, (size_t)str_len);
+ line_ptr = (char *)undo_read_string(&bi, (size_t)str_len);
}
linenr_T line_lnum = (linenr_T)undo_read_4c(&bi);
colnr_T line_colnr = (colnr_T)undo_read_4c(&bi);
@@ -1608,7 +1608,7 @@ void u_read_undo(char *name, const char_u *hash, const char *orig_name FUNC_ATTR
curbuf->b_u_oldhead = old_idx < 0 ? NULL : uhp_table[old_idx];
curbuf->b_u_newhead = new_idx < 0 ? NULL : uhp_table[new_idx];
curbuf->b_u_curhead = cur_idx < 0 ? NULL : uhp_table[cur_idx];
- curbuf->b_u_line_ptr = (char *)line_ptr;
+ curbuf->b_u_line_ptr = line_ptr;
curbuf->b_u_line_lnum = line_lnum;
curbuf->b_u_line_colnr = line_colnr;
curbuf->b_u_numhead = num_head;
@@ -2238,7 +2238,7 @@ target_zero:
/// @param do_buf_event If `true`, send buffer updates.
static void u_undoredo(int undo, bool do_buf_event)
{
- char_u **newarray = NULL;
+ char **newarray = NULL;
linenr_T newlnum = MAXLNUM;
u_entry_T *nuep;
u_entry_T *newlist = NULL;
@@ -2316,13 +2316,13 @@ static void u_undoredo(int undo, bool do_buf_event)
// delete the lines between top and bot and save them in newarray
if (oldsize > 0) {
- newarray = xmalloc(sizeof(char_u *) * (size_t)oldsize);
+ newarray = xmalloc(sizeof(char *) * (size_t)oldsize);
// delete backwards, it goes faster in most cases
long i;
linenr_T lnum;
for (lnum = bot - 1, i = oldsize; --i >= 0; lnum--) {
// what can we do when we run out of memory?
- newarray[i] = (char_u *)u_save_line(lnum);
+ newarray[i] = u_save_line(lnum);
// remember we deleted the last line in the buffer, and a
// dummy empty line will be inserted
if (curbuf->b_ml.ml_line_count == 1) {
@@ -2348,7 +2348,7 @@ static void u_undoredo(int undo, bool do_buf_event)
}
xfree(uep->ue_array[i]);
}
- xfree((char_u *)uep->ue_array);
+ xfree(uep->ue_array);
}
// Adjust marks
@@ -2378,7 +2378,7 @@ static void u_undoredo(int undo, bool do_buf_event)
u_newcount += newsize;
u_oldcount += oldsize;
uep->ue_size = oldsize;
- uep->ue_array = (char **)newarray;
+ uep->ue_array = newarray;
uep->ue_bot = top + newsize + 1;
// insert this entry in front of the new entry list
@@ -2565,11 +2565,11 @@ static void u_undo_end(bool did_undo, bool absolute, bool quiet)
uhp = curbuf->b_u_newhead;
}
- char_u msgbuf[80];
+ char msgbuf[80];
if (uhp == NULL) {
*msgbuf = NUL;
} else {
- undo_fmt_time((char *)msgbuf, sizeof(msgbuf), uhp->uh_time);
+ undo_fmt_time(msgbuf, sizeof(msgbuf), uhp->uh_time);
}
{
@@ -2935,7 +2935,7 @@ static void u_freeentries(buf_T *buf, u_header_T *uhp, u_header_T **uhpp)
#ifdef U_DEBUG
uhp->uh_magic = 0;
#endif
- xfree((char_u *)uhp);
+ xfree(uhp);
buf->b_u_numhead--;
}
@@ -2945,11 +2945,11 @@ static void u_freeentry(u_entry_T *uep, long n)
while (n > 0) {
xfree(uep->ue_array[--n]);
}
- xfree((char_u *)uep->ue_array);
+ xfree(uep->ue_array);
#ifdef U_DEBUG
uep->ue_magic = 0;
#endif
- xfree((char_u *)uep);
+ xfree(uep);
}
/// invalidate the undo buffer; called when storage has already been released