diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-05-31 00:49:17 -0300 |
---|---|---|
committer | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-06-16 01:40:28 -0300 |
commit | 3cb3c20b7451ef4a7bc857026e2bc28b171fbb0f (patch) | |
tree | 889602c0ddd1d647e51f0010605bdc973738696e /src | |
parent | f4002c97dc36e817a59b5e18c852d1a17e775c1c (diff) | |
download | rneovim-3cb3c20b7451ef4a7bc857026e2bc28b171fbb0f.tar.gz rneovim-3cb3c20b7451ef4a7bc857026e2bc28b171fbb0f.tar.bz2 rneovim-3cb3c20b7451ef4a7bc857026e2bc28b171fbb0f.zip |
Fix some "out of memory" comments and few cosmetics
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/charset.c | 5 | ||||
-rw-r--r-- | src/nvim/edit.c | 2 | ||||
-rw-r--r-- | src/nvim/eval.c | 16 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 2 | ||||
-rw-r--r-- | src/nvim/mbyte.c | 2 |
5 files changed, 12 insertions, 15 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 948cb7e569..549c926763 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -9,6 +9,7 @@ #include "nvim/vim.h" #include "nvim/charset.h" #include "nvim/farsi.h" +#include "nvim/func_attr.h" #include "nvim/main.h" #include "nvim/mbyte.h" #include "nvim/memline.h" @@ -321,12 +322,12 @@ void trans_characters(char_u *buf, int bufsize) } /// Translate a string into allocated memory, replacing special chars with -/// printable chars. Returns NULL when out of memory. +/// printable chars. /// /// @param s /// /// @return translated string -char_u *transstr(char_u *s) +char_u *transstr(char_u *s) FUNC_ATTR_NONNULL_RET { char_u *res; char_u *p; diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 7cff8bb9f2..5a70964d57 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -7975,7 +7975,7 @@ static int ins_tab(void) /* * Handle CR or NL in insert mode. - * Return TRUE when out of memory or can't undo. + * Return TRUE when it can't undo. */ static int ins_eol(int c) { diff --git a/src/nvim/eval.c b/src/nvim/eval.c index faa80ed0fa..8a9f8cbd55 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -5150,7 +5150,7 @@ static void list_extend(list_T *l1, list_T *l2, listitem_T *bef) /* * Concatenate lists "l1" and "l2" into a new list, stored in "tv". - * Return FAIL when out of memory. + * Return FAIL on failure to copy. */ static int list_concat(list_T *l1, list_T *l2, typval_T *tv) { @@ -5175,7 +5175,7 @@ static int list_concat(list_T *l1, list_T *l2, typval_T *tv) * Make a copy of list "orig". Shallow if "deep" is FALSE. * The refcount of the new list is set to 1. * See item_copy() for "copyID". - * Returns NULL when out of memory. + * Returns NULL if orig is NULL or some failure happens. */ static list_T *list_copy(list_T *orig, int deep, int copyID) { @@ -5721,7 +5721,7 @@ void dictitem_free(dictitem_T *item) * Make a copy of dict "d". Shallow if "deep" is FALSE. * The refcount of the new dict is set to 1. * See item_copy() for "copyID". - * Returns NULL when out of memory. + * Returns NULL if orig is NULL or some other failure. */ static dict_T *dict_copy(dict_T *orig, int deep, int copyID) { @@ -5865,7 +5865,7 @@ dictitem_T *dict_find(dict_T *d, char_u *key, int len) /* * Get a string item from a dictionary. * When "save" is TRUE allocate memory for it. - * Returns NULL if the entry doesn't exist or out of memory. + * Returns NULL if the entry doesn't exist or some other failure. */ char_u *get_dict_string(dict_T *d, char_u *key, int save) { @@ -5883,13 +5883,11 @@ char_u *get_dict_string(dict_T *d, char_u *key, int save) /* * Get a number item from a dictionary. - * Returns 0 if the entry doesn't exist or out of memory. + * Returns 0 if the entry doesn't exist. */ long get_dict_number(dict_T *d, char_u *key) { - dictitem_T *di; - - di = dict_find(d, key, -1); + dictitem_T *di = dict_find(d, key, -1); if (di == NULL) return 0; return get_tv_number(&di->di_tv); @@ -17436,7 +17434,7 @@ static void func_do_profile(ufunc_T *fp) fp->uf_tml_idx = -1; if (fp->uf_tml_count == NULL || fp->uf_tml_total == NULL || fp->uf_tml_self == NULL) - return; /* out of memory */ + return; fp->uf_profiling = TRUE; } diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index ce70f59c27..fb6ec70f57 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1853,7 +1853,7 @@ int viminfo_readline(vir_T *virp) * * Check for a long line as written by viminfo_writestring(). * - * Return the string in allocated memory (NULL when out of memory). + * Return the string in allocated memory (or NULL to indicate failure). */ char_u * viminfo_readstring ( diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 21fdd31db1..9b651b3c12 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -3528,8 +3528,6 @@ static char_u * iconv_string(vimconv_T *vcp, char_u *str, int slen, int *unconvl memmove(p, result, done); free(result); result = p; - if (result == NULL) /* out of memory */ - break; } to = (char *)result + done; |