diff options
author | John Schmidt <john.schmidt.h@gmail.com> | 2014-04-09 01:05:48 +0200 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-10 17:03:50 -0300 |
commit | 3fcdb2ab29f6285b4b5b4fd706db54a98b1a773f (patch) | |
tree | 0b4486d8e2f44c505ea59102b45385e682a6a98e /src/ex_cmds.c | |
parent | 321c67d610f0e0a8e818cfbb10d966033eb7db58 (diff) | |
download | rneovim-3fcdb2ab29f6285b4b5b4fd706db54a98b1a773f.tar.gz rneovim-3fcdb2ab29f6285b4b5b4fd706db54a98b1a773f.tar.bz2 rneovim-3fcdb2ab29f6285b4b5b4fd706db54a98b1a773f.zip |
Replace `alloc_check` by `xmalloc`
`alloc_check` is just a wrapper around xmalloc, so we can remove it and use
xmalloc directly. ref #487 / #488
The call was replaced in the following files:
- ex_cmds.c
- misc1.c
- ops.c
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r-- | src/ex_cmds.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 2e76ff5e75..8b3a2a4bfd 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -3861,10 +3861,6 @@ void do_sub(exarg_T *eap) if (sub_firstline == NULL) { sub_firstline = vim_strsave(ml_get(sub_firstlnum)); - if (sub_firstline == NULL) { - vim_free(new_start); - goto outofmem; - } } /* Save the line number of the last change for the final @@ -4154,8 +4150,7 @@ void do_sub(exarg_T *eap) * too many calls to alloc()/free()). */ new_start_len = needed_len + 50; - if ((new_start = alloc_check(new_start_len)) == NULL) - goto outofmem; + new_start = (char_u *)xmalloc((size_t)new_start_len); *new_start = NUL; new_end = new_start; } else { @@ -4168,10 +4163,7 @@ void do_sub(exarg_T *eap) needed_len += len; if (needed_len > (int)new_start_len) { new_start_len = needed_len + 50; - if ((p1 = alloc_check(new_start_len)) == NULL) { - vim_free(new_start); - goto outofmem; - } + p1 = (char_u *) xmalloc((size_t)new_start_len); memmove(p1, new_start, (size_t)(len + 1)); vim_free(new_start); new_start = p1; @@ -4388,7 +4380,6 @@ skip: changed_lines(first_line, 0, last_line - i, i); } -outofmem: vim_free(sub_firstline); /* may have to free allocated copy of the line */ /* ":s/pat//n" doesn't move the cursor */ |