Mercurial > vim
changeset 11317:e45c6e4d78af v8.0.0544
patch 8.0.0544: cppcheck warnings
commit https://github.com/vim/vim/commit/866c68861071f8cd1ef5a82445bebaafc8626e7e
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Apr 7 14:02:01 2017 +0200
patch 8.0.0544: cppcheck warnings
Problem: Cppcheck warnings.
Solution: Use temp variable. Change NUL to NULL. Swap conditions. (Dominique
Pelle)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 07 Apr 2017 14:15:06 +0200 |
parents | f7365ae4d326 |
children | fa35406bc07e |
files | src/channel.c src/edit.c src/farsi.c src/version.c |
diffstat | 4 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/channel.c +++ b/src/channel.c @@ -2571,9 +2571,14 @@ may_invoke_callback(channel_T *channel, if (nl == NULL) { /* Flush remaining message that is missing a NL. */ - buf = vim_realloc(buf, node->rq_buflen + 1); - if (buf == NULL) + char_u *new_buf; + + new_buf = vim_realloc(buf, node->rq_buflen + 1); + if (new_buf == NULL) + /* This might fail over and over again, should the message + * be dropped? */ return FALSE; + buf = new_buf; node->rq_buffer = buf; nl = buf + node->rq_buflen++; *nl = NUL;
--- a/src/edit.c +++ b/src/edit.c @@ -9524,7 +9524,7 @@ bracketed_paste(paste_mode_T mode, int d #endif buf[idx++] = c; buf[idx] = NUL; - if (end != NUL && STRNCMP(buf, end, idx) == 0) + if (end != NULL && STRNCMP(buf, end, idx) == 0) { if (end[idx] == NUL) break; /* Found the end of paste code. */