diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-05-09 03:30:26 -0300 |
---|---|---|
committer | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-05-19 14:50:23 -0300 |
commit | 21784aeb005e78f04f4c1d398bc486be0a65248e (patch) | |
tree | 5180a6de4bd033571e351d06b04419a3af768198 /src/nvim/strings.c | |
parent | a80d7e86c1f088c5b68d8e8929cc72a0d9680f76 (diff) | |
download | rneovim-21784aeb005e78f04f4c1d398bc486be0a65248e.tar.gz rneovim-21784aeb005e78f04f4c1d398bc486be0a65248e.tar.bz2 rneovim-21784aeb005e78f04f4c1d398bc486be0a65248e.zip |
Replace alloc() with xmalloc() and remove immediate OOM checks
Diffstat (limited to 'src/nvim/strings.c')
-rw-r--r-- | src/nvim/strings.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nvim/strings.c b/src/nvim/strings.c index 1cadc5df09..aaf6a67dea 100644 --- a/src/nvim/strings.c +++ b/src/nvim/strings.c @@ -97,7 +97,7 @@ char_u *vim_strsave_escaped_ext(char_u *string, char_u *esc_chars, int cc, int b ++length; /* count a backslash */ ++length; /* count an ordinary char */ } - escaped_string = alloc(length); + escaped_string = xmalloc(length); p2 = escaped_string; for (p = string; *p; p++) { if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) { @@ -158,7 +158,7 @@ char_u *vim_strsave_shellescape(char_u *string, bool do_special, bool do_newline } /* Allocate memory for the result and fill it. */ - escaped_string = alloc(length); + escaped_string = xmalloc(length); d = escaped_string; /* add opening quote */ @@ -264,7 +264,7 @@ char_u *strup_save(char_u *orig) l = utf_ptr2len(p); newl = utf_char2len(uc); if (newl != l) { - s = alloc((unsigned)STRLEN(res) + 1 + newl - l); + s = xmalloc(STRLEN(res) + 1 + newl - l); memmove(s, res, p - res); STRCPY(s + (p - res) + newl, p + l); p = s + (p - res); |