diff options
author | Eliseo Martínez <eliseomarmol@gmail.com> | 2015-01-23 15:02:51 +0100 |
---|---|---|
committer | Eliseo Martínez <eliseomarmol@gmail.com> | 2015-01-27 01:33:34 +0100 |
commit | 5deb06597ce72470a5cc86d4f52ee9b025288228 (patch) | |
tree | 71716550645e4174027314de4731dbc4b8300c42 | |
parent | 00f18e2e09af35494d0b94ae76a9dbc3e0319d89 (diff) | |
download | rneovim-5deb06597ce72470a5cc86d4f52ee9b025288228.tar.gz rneovim-5deb06597ce72470a5cc86d4f52ee9b025288228.tar.bz2 rneovim-5deb06597ce72470a5cc86d4f52ee9b025288228.zip |
Remove nonnullret deadcode: xmalloc & xrealloc.
-rw-r--r-- | src/nvim/if_cscope.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index bb41db6168..843cbcf6f9 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -1649,7 +1649,6 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches) char *cntxformat = " <<%s>>"; char *context; char *cstag_msg = _("Cscope tag: %s"); - char *csfmt_str = "%4d %6s "; assert (num_matches > 0); @@ -1691,17 +1690,15 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches) lno[strlen(lno)-2] = '\0'; /* ignore ;" at the end */ + const char *csfmt_str = "%4d %6s "; /* hopefully 'num' (num of matches) will be less than 10^16 */ newsize = strlen(csfmt_str) + 16 + strlen(lno); if (bufsize < newsize) { buf = xrealloc(buf, newsize); bufsize = newsize; } - if (buf != NULL) { - /* csfmt_str = "%4d %6s "; */ - (void)sprintf(buf, csfmt_str, num, lno); - MSG_PUTS_ATTR(buf, hl_attr(HLF_CM)); - } + (void)sprintf(buf, csfmt_str, num, lno); + MSG_PUTS_ATTR(buf, hl_attr(HLF_CM)); MSG_PUTS_LONG_ATTR(cs_pathcomponents(fname), hl_attr(HLF_CM)); /* compute the required space for the context */ @@ -1715,16 +1712,14 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches) buf = xrealloc(buf, newsize); bufsize = newsize; } - if (buf != NULL) { - (void)sprintf(buf, cntxformat, context); - - /* print the context only if it fits on the same line */ - if (msg_col + (int)strlen(buf) >= (int)Columns) - msg_putchar('\n'); - msg_advance(12); - MSG_PUTS_LONG(buf); + (void)sprintf(buf, cntxformat, context); + + /* print the context only if it fits on the same line */ + if (msg_col + (int)strlen(buf) >= (int)Columns) msg_putchar('\n'); - } + msg_advance(12); + MSG_PUTS_LONG(buf); + msg_putchar('\n'); if (extra != NULL) { msg_advance(13); MSG_PUTS_LONG(extra); |