diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-24 18:54:09 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-24 18:54:09 +0200 |
commit | 964b3746b9c81e65887e2ac9a335f181db2bb592 (patch) | |
tree | 9afaaac41a1c4f71b359fd6706b88df00e22e7a1 /src/undo.c | |
parent | d33a764123a8aedb20cd84aeff3b94810ee67c4c (diff) | |
download | vim-git-964b3746b9c81e65887e2ac9a335f181db2bb592.tar.gz |
patch 8.1.1384: using "int" for alloc() often results in compiler warningsv8.1.1384
Problem: Using "int" for alloc() often results in compiler warnings.
Solution: Use "size_t" and remove type casts. Remove alloc_check(), Vim
only works with 32 bit ints anyway.
Diffstat (limited to 'src/undo.c')
-rw-r--r-- | src/undo.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/undo.c b/src/undo.c index c4558d1c7..ed2cd58fe 100644 --- a/src/undo.c +++ b/src/undo.c @@ -367,6 +367,8 @@ u_save_line(undoline_T *ul, linenr_T lnum) } else { + // This uses the length in the memline, thus text properties are + // included. ul->ul_len = curbuf->b_ml.ml_line_len; ul->ul_line = vim_memsave(line, ul->ul_len); } @@ -1121,7 +1123,7 @@ undo_read(bufinfo_T *bi, char_u *buffer, size_t size) static char_u * read_string_decrypt(bufinfo_T *bi, int len) { - char_u *ptr = alloc((unsigned)len + 1); + char_u *ptr = alloc(len + 1); if (ptr != NULL) { @@ -2689,7 +2691,8 @@ u_undoredo(int undo) char_u *p = ml_get(top + 1 + i); if (curbuf->b_ml.ml_line_len != uep->ue_array[i].ul_len - || memcmp(uep->ue_array[i].ul_line, p, curbuf->b_ml.ml_line_len) != 0) + || memcmp(uep->ue_array[i].ul_line, p, + curbuf->b_ml.ml_line_len) != 0) break; } if (i == newsize && newlnum == MAXLNUM && uep->ue_next == NULL) @@ -2750,9 +2753,11 @@ u_undoredo(int undo) // If the file is empty, there is an empty line 1 that we // should get rid of, by replacing it with the new line. if (empty_buffer && lnum == 0) - ml_replace_len((linenr_T)1, uep->ue_array[i].ul_line, uep->ue_array[i].ul_len, TRUE, TRUE); + ml_replace_len((linenr_T)1, uep->ue_array[i].ul_line, + uep->ue_array[i].ul_len, TRUE, TRUE); else - ml_append(lnum, uep->ue_array[i].ul_line, (colnr_T)uep->ue_array[i].ul_len, FALSE); + ml_append(lnum, uep->ue_array[i].ul_line, + (colnr_T)uep->ue_array[i].ul_len, FALSE); vim_free(uep->ue_array[i].ul_line); } vim_free((char_u *)uep->ue_array); |