From 4f5fff8735dd26faa39a2789d43b3e450c599eb0 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Fri, 26 Jul 2019 16:56:32 -0400 Subject: [PATCH] utils: Remove ATTRIBUTE_NONNULL(1) from virCommandSetSendBuffer Remove the ATTRIBUTE_NONNULL(1) from virCommandSetSendBuffer() prototype since we are checking for '!cmd' and move the initialization if 'i' after the test for '!cmd'. Signed-off-by: Stefan Berger Reviewed-by: John Ferlan Message-Id: <20190726205633.2041912-4-stefanb@linux.vnet.ibm.com> --- src/util/vircommand.c | 3 ++- src/util/vircommand.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 774038e536..2df71014f8 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -1775,7 +1775,7 @@ virCommandSetSendBuffer(virCommandPtr cmd, int fd, unsigned char *buffer, size_t buflen) { - size_t i = virCommandGetNumSendBuffers(cmd); + size_t i; if (!cmd || cmd->has_error) return -1; @@ -1787,6 +1787,7 @@ virCommandSetSendBuffer(virCommandPtr cmd, return -1; } + i = virCommandGetNumSendBuffers(cmd); if (VIR_REALLOC_N(cmd->sendBuffers, i + 1) < 0) { cmd->has_error = ENOMEM; return -1; diff --git a/src/util/vircommand.h b/src/util/vircommand.h index c2abc7b2c3..74574e3fb1 100644 --- a/src/util/vircommand.h +++ b/src/util/vircommand.h @@ -149,7 +149,7 @@ void virCommandSetWorkingDirectory(virCommandPtr cmd, int virCommandSetSendBuffer(virCommandPtr cmd, int fd, unsigned char *buffer, size_t buflen) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3); + ATTRIBUTE_NONNULL(3); void virCommandSetInputBuffer(virCommandPtr cmd, const char *inbuf) ATTRIBUTE_NONNULL(2);