]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.0853: ml_delete() often called with FALSE argument v8.2.0853
authorBram Moolenaar <Bram@vim.org>
Sat, 30 May 2020 18:30:46 +0000 (20:30 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 30 May 2020 18:30:46 +0000 (20:30 +0200)
Problem:    ml_delete() often called with FALSE argument.
Solution:   Use ml_delete_flags(x, ML_DEL_MESSAGE) when argument is TRUE.

22 files changed:
src/buffer.c
src/change.c
src/diff.c
src/evalbuffer.c
src/ex_cmds.c
src/ex_docmd.c
src/fileio.c
src/if_lua.c
src/if_mzsch.c
src/if_perl.xs
src/if_py_both.h
src/if_ruby.c
src/if_tcl.c
src/memline.c
src/normal.c
src/popupmenu.c
src/popupwin.c
src/proto/memline.pro
src/quickfix.c
src/spell.c
src/terminal.c
src/version.c

index a657e72422eed2365058af72d9374d078b6f8d39..df92ecdbd4de3e888059f18ccef52a40450bee22 100644 (file)
@@ -103,13 +103,13 @@ read_buffer(
     {
        // Delete the binary lines.
        while (--line_count >= 0)
-           ml_delete((linenr_T)1, FALSE);
+           ml_delete((linenr_T)1);
     }
     else
     {
        // Delete the converted lines.
        while (curbuf->b_ml.ml_line_count > line_count)
-           ml_delete(line_count, FALSE);
+           ml_delete(line_count);
     }
     // Put the cursor on the first line.
     curwin->w_cursor.lnum = 1;
index 45d67044e66b1e3d8041a9af935672eebfe96d6d..3a823b62969230b82e1046a3351cab90583e2a53 100644 (file)
@@ -2317,7 +2317,7 @@ del_lines(long nlines,    int undo)
        if (curbuf->b_ml.ml_flags & ML_EMPTY)       // nothing to delete
            break;
 
-       ml_delete(first, TRUE);
+       ml_delete_flags(first, ML_DEL_MESSAGE);
        ++n;
 
        // If we delete the last line in the file, stop
index 16389fd92c59af60781eafeafaca4e52687741cc..88dc8a653849902973dda2f2ced4e27cb34a8495 100644 (file)
@@ -2764,7 +2764,7 @@ ex_diffgetput(exarg_T *eap)
            {
                // remember deleting the last line of the buffer
                buf_empty = curbuf->b_ml.ml_line_count == 1;
-               ml_delete(lnum, FALSE);
+               ml_delete(lnum);
                --added;
            }
            for (i = 0; i < dp->df_count[idx_from] - start_skip - end_skip; ++i)
@@ -2786,7 +2786,7 @@ ex_diffgetput(exarg_T *eap)
                        // Added the first line into an empty buffer, need to
                        // delete the dummy empty line.
                        buf_empty = FALSE;
-                       ml_delete((linenr_T)2, FALSE);
+                       ml_delete((linenr_T)2);
                    }
                }
            }
index adbbca3f7b66010f4f62d6eb1920c6f2fa624d82..df5270a95332571791292906c7cb48001a7ef7e6 100644 (file)
@@ -513,7 +513,7 @@ f_deletebufline(typval_T *argvars, typval_T *rettv)
     }
 
     for (lnum = first; lnum <= last; ++lnum)
-       ml_delete(first, TRUE);
+       ml_delete_flags(first, ML_DEL_MESSAGE);
 
     FOR_ALL_TAB_WINDOWS(tp, wp)
        if (wp->w_buffer == buf)
index 777f1490cfd5e1da0064a7f7819b7e368b8c482d..ac55c268a22dd3b3d9d110bd48035cbccaaf9938 100644 (file)
@@ -633,7 +633,7 @@ ex_sort(exarg_T *eap)
     // delete the original lines if appending worked
     if (i == count)
        for (i = 0; i < count; ++i)
-           ml_delete(eap->line1, FALSE);
+           ml_delete(eap->line1);
     else
        count = 0;
 
@@ -779,7 +779,7 @@ do_move(linenr_T line1, linenr_T line2, linenr_T dest)
        return FAIL;
 
     for (l = line1; l <= line2; l++)
-       ml_delete(line1 + extra, TRUE);
+       ml_delete_flags(line1 + extra, ML_DEL_MESSAGE);
 
     if (!global_busy && num_lines > p_report)
        smsg(NGETTEXT("%ld line moved", "%ld lines moved", num_lines),
@@ -3280,7 +3280,7 @@ ex_append(exarg_T *eap)
 
        if (empty)
        {
-           ml_delete(2L, FALSE);
+           ml_delete(2L);
            empty = FALSE;
        }
     }
@@ -3331,7 +3331,7 @@ ex_change(exarg_T *eap)
     {
        if (curbuf->b_ml.ml_flags & ML_EMPTY)       // nothing to delete
            break;
-       ml_delete(eap->line1, FALSE);
+       ml_delete(eap->line1);
     }
 
     // make sure the cursor is not beyond the end of the file now
@@ -4531,7 +4531,7 @@ skip:
                            if (u_savedel(lnum, nmatch_tl) != OK)
                                break;
                            for (i = 0; i < nmatch_tl; ++i)
-                               ml_delete(lnum, (int)FALSE);
+                               ml_delete(lnum);
                            mark_adjust(lnum, lnum + nmatch_tl - 1,
                                                   (long)MAXLNUM, -nmatch_tl);
                            if (subflags.do_ask)
index a4db3c84447b2f4d3ddf5119ebfe55b1a329ea25..7b53e6c6a6cd09ce81616ac09e61374b787bae00 100644 (file)
@@ -6557,7 +6557,7 @@ ex_read(exarg_T *eap)
                    lnum = 1;
                if (*ml_get(lnum) == NUL && u_savedel(lnum, 1L) == OK)
                {
-                   ml_delete(lnum, FALSE);
+                   ml_delete(lnum);
                    if (curwin->w_cursor.lnum > 1
                                             && curwin->w_cursor.lnum >= lnum)
                        --curwin->w_cursor.lnum;
index 613f92359dfeff563bdc632f66c50d4ac6038491..32af14c4d5c4b896b50a0c12b697563c38647fb0 100644 (file)
@@ -862,7 +862,7 @@ retry:
        }
        // Delete the previously read lines.
        while (lnum > from)
-           ml_delete(lnum--, FALSE);
+           ml_delete(lnum--);
        file_rewind = FALSE;
        if (set_options)
        {
@@ -2292,7 +2292,7 @@ failed:
 #ifdef FEAT_NETBEANS_INTG
            netbeansFireChanges = 0;
 #endif
-           ml_delete(curbuf->b_ml.ml_line_count, FALSE);
+           ml_delete(curbuf->b_ml.ml_line_count);
 #ifdef FEAT_NETBEANS_INTG
            netbeansFireChanges = 1;
 #endif
@@ -3933,7 +3933,7 @@ move_lines(buf_T *frombuf, buf_T *tobuf)
     {
        curbuf = frombuf;
        for (lnum = curbuf->b_ml.ml_line_count; lnum > 0; --lnum)
-           if (ml_delete(lnum, FALSE) == FAIL)
+           if (ml_delete(lnum) == FAIL)
            {
                // Oops!  We could try putting back the saved lines, but that
                // might fail again...
@@ -4329,7 +4329,7 @@ buf_reload(buf_T *buf, int orig_mode)
                    // Put the text back from the save buffer.  First
                    // delete any lines that readfile() added.
                    while (!BUFEMPTY())
-                       if (ml_delete(buf->b_ml.ml_line_count, FALSE) == FAIL)
+                       if (ml_delete(buf->b_ml.ml_line_count) == FAIL)
                            break;
                    (void)move_lines(savebuf, buf);
                }
index 9a3081bb4fa7b93645ffb81d7f182eaf687480a6..3ecedaf7d609a7ad375a8ff009050ca6362da666 100644 (file)
@@ -1341,7 +1341,7 @@ luaV_buffer_newindex(lua_State *L)
            curbuf = buf;
            luaL_error(L, "cannot save undo information");
        }
-       else if (ml_delete(n, FALSE) == FAIL)
+       else if (ml_delete(n) == FAIL)
        {
            curbuf = buf;
            luaL_error(L, "cannot delete line");
index 8cc2e21454455b0e82348f3301afbb8155a46950..bfcdbea97ee753dd70b9d63c47279c7ecbacb603 100644 (file)
@@ -2468,7 +2468,7 @@ set_buffer_line(void *data, int argc, Scheme_Object **argv)
            curbuf = savebuf;
            raise_vim_exn(_("cannot save undo information"));
        }
-       else if (ml_delete((linenr_T)n, FALSE) == FAIL)
+       else if (ml_delete((linenr_T)n) == FAIL)
        {
            curbuf = savebuf;
            raise_vim_exn(_("cannot delete line"));
@@ -2597,7 +2597,7 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv)
        else
        {
            for (i = 0; i < old_len; i++)
-               if (ml_delete((linenr_T)lo, FALSE) == FAIL)
+               if (ml_delete((linenr_T)lo) == FAIL)
                {
                    curbuf = savebuf;
                    raise_vim_exn(_("cannot delete line"));
@@ -2665,7 +2665,7 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv)
             */
            for (i = 0; i < old_len - new_len; ++i)
            {
-               if (ml_delete((linenr_T)lo, FALSE) == FAIL)
+               if (ml_delete((linenr_T)lo) == FAIL)
                {
                    curbuf = savebuf;
                    free_array(array);
index 015189cc047c145d3c5de8010cf9e56628f750c7..ef02730479e31f8178a6772c2930fcefdc896f5f 100644 (file)
@@ -1067,7 +1067,7 @@ replace_line(linenr_T *line, linenr_T *end)
     }
     else
     {
-       ml_delete(*line, FALSE);
+       ml_delete(*line);
        deleted_lines_mark(*line, 1L);
        --(*end);
        --(*line);
@@ -1862,7 +1862,7 @@ Delete(vimbuf, ...)
 
                    if (u_savedel(lnum, 1) == OK)
                    {
-                       ml_delete(lnum, 0);
+                       ml_delete(lnum);
                        check_cursor();
                        deleted_lines_mark(lnum, 1L);
                    }
index 9f563f0afd3fd465c3f8e2d562d7206b27b54b71..e262d1f75fd9a72adfec5fc1bf1c637ab6a99f6a 100644 (file)
@@ -4399,7 +4399,7 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change)
 
        if (u_savedel((linenr_T)n, 1L) == FAIL)
            RAISE_UNDO_FAIL;
-       else if (ml_delete((linenr_T)n, FALSE) == FAIL)
+       else if (ml_delete((linenr_T)n) == FAIL)
            RAISE_DELETE_LINE_FAIL;
        else
        {
@@ -4512,7 +4512,7 @@ SetBufferLineList(
        {
            for (i = 0; i < n; ++i)
            {
-               if (ml_delete((linenr_T)lo, FALSE) == FAIL)
+               if (ml_delete((linenr_T)lo) == FAIL)
                {
                    RAISE_DELETE_LINE_FAIL;
                    break;
@@ -4588,7 +4588,7 @@ SetBufferLineList(
        if (!PyErr_Occurred())
        {
            for (i = 0; i < old_len - new_len; ++i)
-               if (ml_delete((linenr_T)lo, FALSE) == FAIL)
+               if (ml_delete((linenr_T)lo) == FAIL)
                {
                    RAISE_DELETE_LINE_FAIL;
                    break;
index 6773a2a38af5de0643ed70b240818554ab937550..2480ee4d12149080d79d5299f322ddd1c7c6931a 100644 (file)
@@ -1442,7 +1442,7 @@ buffer_delete(VALUE self, VALUE num)
 
        if (u_savedel(n, 1) == OK)
        {
-           ml_delete(n, 0);
+           ml_delete(n);
 
            // Changes to non-active buffers should properly refresh
            //   SegPhault - 01/09/05
index 17e20ee3899ee4926befa01415a3739792e15b1f..c274b26750d111568429105c9cb7f19d7e82ba57 100644 (file)
@@ -735,7 +735,7 @@ bufselfcmd(
                    i = n;
                    do
                    {
-                       if (ml_delete((linenr_T)i, FALSE) != OK)
+                       if (ml_delete((linenr_T)i) != OK)
                            goto setListError;
                        ++n;
                    } while (n <= val2);
@@ -783,7 +783,7 @@ bufselfcmd(
            }
            for (i = 0; i < n; i++)
            {
-               ml_delete((linenr_T)val1, FALSE);
+               ml_delete((linenr_T)val1);
                err = vimerror(interp);
                if (err != TCL_OK)
                    break;
index 3379a396506470fb230c32cbce0d26f4f9cff2c4..73db42f9806f065f5dda32bbc5f1590353099744 100644 (file)
@@ -1386,7 +1386,7 @@ ml_recover(int checkext)
      * contents of the current buffer.
      */
     while (!(curbuf->b_ml.ml_flags & ML_EMPTY))
-       ml_delete((linenr_T)1, FALSE);
+       ml_delete((linenr_T)1);
 
     /*
      * Try reading the original file to obtain the values of 'fileformat',
@@ -1664,7 +1664,7 @@ ml_recover(int checkext)
      */
     while (curbuf->b_ml.ml_line_count > lnum
                                       && !(curbuf->b_ml.ml_flags & ML_EMPTY))
-       ml_delete(curbuf->b_ml.ml_line_count, FALSE);
+       ml_delete(curbuf->b_ml.ml_line_count);
     curbuf->b_flags |= BF_RECOVERED;
 
     recoverymode = FALSE;
@@ -3705,9 +3705,9 @@ theend:
  * return FAIL for failure, OK otherwise
  */
     int
-ml_delete(linenr_T lnum, int message)
+ml_delete(linenr_T lnum)
 {
-    return ml_delete_flags(lnum, message ? ML_DEL_MESSAGE : 0);
+    return ml_delete_flags(lnum, 0);
 }
 
 /*
index a39b1d4e25331ce5d714226f12ac373fb9b45e4f..f4001411db14b55df3ac92f3009b73c9f5ff73c5 100644 (file)
@@ -7413,7 +7413,7 @@ nv_put_opt(cmdarg_T *cap, int fix_indent)
        // line that needs to be deleted now.
        if (empty && *ml_get(curbuf->b_ml.ml_line_count) == NUL)
        {
-           ml_delete(curbuf->b_ml.ml_line_count, TRUE);
+           ml_delete_flags(curbuf->b_ml.ml_line_count, ML_DEL_MESSAGE);
            deleted_lines(curbuf->b_ml.ml_line_count + 1, 1);
 
            // If the cursor was in that line, move it to the end of the last
index 2fe4cff402b0199aa971253048e894eab7ece085..197cdca76a7b933262927586ecb6966c88b104e9 100644 (file)
@@ -817,7 +817,7 @@ pum_set_selected(int n, int repeat UNUSED)
                {
                    // Already a "wipeout" buffer, make it empty.
                    while (!BUFEMPTY())
-                       ml_delete((linenr_T)1, FALSE);
+                       ml_delete((linenr_T)1);
                }
                else
                {
@@ -860,7 +860,7 @@ pum_set_selected(int n, int repeat UNUSED)
                        }
                    }
                    // delete the empty last line
-                   ml_delete(curbuf->b_ml.ml_line_count, FALSE);
+                   ml_delete(curbuf->b_ml.ml_line_count);
 
                    // Increase the height of the preview window to show the
                    // text, but no more than 'previewheight' lines.
index cee848a13c98a68ae0bd917db2996344831e90d3..fbda48bf749cde88994f76908cad045e014b3c4d 100644 (file)
@@ -1537,7 +1537,7 @@ popup_set_buffer_text(buf_T *buf, typval_T text)
     // Clear the buffer, then replace the lines.
     curbuf = buf;
     for (lnum = buf->b_ml.ml_line_count; lnum > 0; --lnum)
-       ml_delete(lnum, FALSE);
+       ml_delete(lnum);
     curbuf = curwin->w_buffer;
 
     // Add text to the buffer.
@@ -1563,7 +1563,7 @@ popup_set_buffer_text(buf_T *buf, typval_T text)
 
     // delete the line that was in the empty buffer
     curbuf = buf;
-    ml_delete(buf->b_ml.ml_line_count, FALSE);
+    ml_delete(buf->b_ml.ml_line_count);
     curbuf = curwin->w_buffer;
 }
 
index de11868e51fa40611431901a588032b37ddb52e5..364f0aae2f8b31b1b0b0df58f465605ee9a8a4dd 100644 (file)
@@ -26,7 +26,7 @@ int ml_append_flags(linenr_T lnum, char_u *line, colnr_T len, int flags);
 int ml_append_buf(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, int newfile);
 int ml_replace(linenr_T lnum, char_u *line, int copy);
 int ml_replace_len(linenr_T lnum, char_u *line_arg, colnr_T len_arg, int has_props, int copy);
-int ml_delete(linenr_T lnum, int message);
+int ml_delete(linenr_T lnum);
 int ml_delete_flags(linenr_T lnum, int flags);
 void ml_setmarked(linenr_T lnum);
 linenr_T ml_firstmarked(void);
index 4b3f1640007f10c91fb48b6a0f26783cc7375df7..f3ad4cde205b455b4c8a083098e008bf472ad9eb 100644 (file)
@@ -4499,7 +4499,7 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last)
 
        // delete all existing lines
        while ((curbuf->b_ml.ml_flags & ML_EMPTY) == 0)
-           (void)ml_delete((linenr_T)1, FALSE);
+           (void)ml_delete((linenr_T)1);
     }
 
     // Check if there is anything to display
@@ -4533,7 +4533,7 @@ qf_fill_buffer(qf_list_T *qfl, buf_T *buf, qfline_T *old_last)
 
        if (old_last == NULL)
            // Delete the empty line which is now at the end
-           (void)ml_delete(lnum + 1, FALSE);
+           (void)ml_delete(lnum + 1);
     }
 
     // correct cursor position
index dab6aeaf4f6618c10423973e7e0d7e384a35294e..20826f3fe98150c7a79ec4331abc10016d3a5e55 100644 (file)
@@ -3810,7 +3810,7 @@ ex_spelldump(exarg_T *eap)
 
     // Delete the empty line that we started with.
     if (curbuf->b_ml.ml_line_count > 1)
-       ml_delete(curbuf->b_ml.ml_line_count, FALSE);
+       ml_delete(curbuf->b_ml.ml_line_count);
 
     redraw_later(NOT_VALID);
 }
index 59bf03995cd5c84335880cd7e11f35a764736f07..86a1a0fc3519f03e5eb7fb73fa75ee72c1342aac 100644 (file)
@@ -1609,7 +1609,7 @@ add_scrollback_line_to_buffer(term_T *term, char_u *text, int len)
     {
        // Delete the empty line that was in the empty buffer.
        curbuf = buf;
-       ml_delete(1, FALSE);
+       ml_delete(1);
        curbuf = curwin->w_buffer;
     }
 }
@@ -1683,7 +1683,7 @@ cleanup_scrollback(term_T *term)
     while (curbuf->b_ml.ml_line_count > term->tl_scrollback_scrolled
                                                            && gap->ga_len > 0)
     {
-       ml_delete(curbuf->b_ml.ml_line_count, FALSE);
+       ml_delete(curbuf->b_ml.ml_line_count);
        line = (sb_line_T *)gap->ga_data + gap->ga_len - 1;
        vim_free(line->sb_cells);
        --gap->ga_len;
@@ -3142,7 +3142,7 @@ limit_scrollback(term_T *term, garray_T *gap, int update_buffer)
        {
            vim_free(((sb_line_T *)gap->ga_data + i)->sb_cells);
            if (update_buffer)
-               ml_delete(1, FALSE);
+               ml_delete(1);
        }
        curbuf = curwin->w_buffer;
 
@@ -5148,7 +5148,7 @@ term_load_dump(typval_T *argvars, typval_T *rettv, int do_diff)
        {
            buf = curbuf;
            while (!(curbuf->b_ml.ml_flags & ML_EMPTY))
-               ml_delete((linenr_T)1, FALSE);
+               ml_delete((linenr_T)1);
            free_scrollback(curbuf->b_term);
            redraw_later(NOT_VALID);
        }
@@ -5183,7 +5183,7 @@ term_load_dump(typval_T *argvars, typval_T *rettv, int do_diff)
        }
 
        // Delete the empty line that was in the empty buffer.
-       ml_delete(1, FALSE);
+       ml_delete(1);
 
        // For term_dumpload() we are done here.
        if (!do_diff)
@@ -5374,7 +5374,7 @@ term_swap_diff()
        if (p == NULL)
            return OK;
        ml_append(bot_start, p, 0, FALSE);
-       ml_delete(1, FALSE);
+       ml_delete(1);
        vim_free(p);
     }
 
@@ -5384,7 +5384,7 @@ term_swap_diff()
        p = vim_strsave(ml_get(bot_start + lnum));
        if (p == NULL)
            return OK;
-       ml_delete(bot_start + lnum, FALSE);
+       ml_delete(bot_start + lnum);
        ml_append(lnum - 1, p, 0, FALSE);
        vim_free(p);
     }
@@ -5394,14 +5394,14 @@ term_swap_diff()
     if (p == NULL)
        return OK;
     ml_append(line_count - top_rows - 1, p, 0, FALSE);
-    ml_delete(bot_rows + 1, FALSE);
+    ml_delete(bot_rows + 1);
     vim_free(p);
 
     // move bottom title to top
     p = vim_strsave(ml_get(line_count - top_rows));
     if (p == NULL)
        return OK;
-    ml_delete(line_count - top_rows, FALSE);
+    ml_delete(line_count - top_rows);
     ml_append(bot_rows, p, 0, FALSE);
     vim_free(p);
 
index f60d1a49131f0f46d0ce85ebdcee4755c960890f..3bd012bcce03bb021c3a906edbceacbfcbfab1b3 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    853,
 /**/
     852,
 /**/