aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2015-01-23 14:13:16 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2015-01-27 01:33:31 +0100
commit2ad0ca9c76567ec573e023af03c13f8d519fba5b (patch)
treeb8cb32a48bbebbffcefb492c6bc47a3edce1f529
parent6425627c3fe1d4c0a88b7309f248f57490b874fd (diff)
downloadrneovim-2ad0ca9c76567ec573e023af03c13f8d519fba5b.tar.gz
rneovim-2ad0ca9c76567ec573e023af03c13f8d519fba5b.tar.bz2
rneovim-2ad0ca9c76567ec573e023af03c13f8d519fba5b.zip
Remove nonnullret deadcode: Mark new nonnullret functions.
-rw-r--r--src/nvim/charset.c16
-rw-r--r--src/nvim/ex_getln.c51
-rw-r--r--src/nvim/fileio.c2
3 files changed, 32 insertions, 37 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 86d6acc60b..6fb5ebf3e4 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -390,19 +390,13 @@ char_u *transstr(char_u *s) FUNC_ATTR_NONNULL_RET
return res;
}
-/// Convert the string "str[orglen]" to do ignore-case comparing. Uses the
-/// current locale.
+/// Convert the string "str[orglen]" to do ignore-case comparing.
+/// Use the current locale.
///
-/// When "buf" is NULL returns an allocated string (NULL for out-of-memory).
-/// Otherwise puts the result in "buf[buflen]".
-///
-/// @param str
-/// @param orglen
-/// @param buf
-/// @param buflen
-///
-/// @return converted string.
+/// When "buf" is NULL, return an allocated string.
+/// Otherwise, put the result in buf, limited by buflen, and return buf.
char_u* str_foldcase(char_u *str, int orglen, char_u *buf, int buflen)
+ FUNC_ATTR_NONNULL_RET
{
garray_T ga;
int i;
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index b942f69f61..ae8ec4637f 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -3265,6 +3265,7 @@ addstar (
int len,
int context /* EXPAND_FILES etc. */
)
+ FUNC_ATTR_NONNULL_RET
{
char_u *retval;
int i, j;
@@ -3343,35 +3344,33 @@ addstar (
}
} else {
retval = xmalloc(len + 4);
- if (retval != NULL) {
- STRLCPY(retval, fname, len + 1);
+ STRLCPY(retval, fname, len + 1);
- /*
- * Don't add a star to *, ~, ~user, $var or `cmd`.
- * * would become **, which walks the whole tree.
- * ~ would be at the start of the file name, but not the tail.
- * $ could be anywhere in the tail.
- * ` could be anywhere in the file name.
- * When the name ends in '$' don't add a star, remove the '$'.
- */
- tail = path_tail(retval);
- ends_in_star = (len > 0 && retval[len - 1] == '*');
+ /*
+ * Don't add a star to *, ~, ~user, $var or `cmd`.
+ * * would become **, which walks the whole tree.
+ * ~ would be at the start of the file name, but not the tail.
+ * $ could be anywhere in the tail.
+ * ` could be anywhere in the file name.
+ * When the name ends in '$' don't add a star, remove the '$'.
+ */
+ tail = path_tail(retval);
+ ends_in_star = (len > 0 && retval[len - 1] == '*');
#ifndef BACKSLASH_IN_FILENAME
- for (i = len - 2; i >= 0; --i) {
- if (retval[i] != '\\')
- break;
- ends_in_star = !ends_in_star;
- }
-#endif
- if ((*retval != '~' || tail != retval)
- && !ends_in_star
- && vim_strchr(tail, '$') == NULL
- && vim_strchr(retval, '`') == NULL)
- retval[len++] = '*';
- else if (len > 0 && retval[len - 1] == '$')
- --len;
- retval[len] = NUL;
+ for (i = len - 2; i >= 0; --i) {
+ if (retval[i] != '\\')
+ break;
+ ends_in_star = !ends_in_star;
}
+#endif
+ if ((*retval != '~' || tail != retval)
+ && !ends_in_star
+ && vim_strchr(tail, '$') == NULL
+ && vim_strchr(retval, '`') == NULL)
+ retval[len++] = '*';
+ else if (len > 0 && retval[len - 1] == '$')
+ --len;
+ retval[len] = NUL;
}
return retval;
}
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 370584b095..c2f137b88e 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -28,6 +28,7 @@
#include "nvim/ex_docmd.h"
#include "nvim/ex_eval.h"
#include "nvim/fold.h"
+#include "nvim/func_attr.h"
#include "nvim/getchar.h"
#include "nvim/hashtab.h"
#include "nvim/iconv.h"
@@ -2106,6 +2107,7 @@ void set_forced_fenc(exarg_T *eap)
* When *pp is not set to NULL, the result is in allocated memory.
*/
static char_u *next_fenc(char_u **pp)
+ FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET
{
char_u *p;
char_u *r;