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 <stefanb@linux.ibm.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
Message-Id: <20190726205633.2041912-4-stefanb@linux.vnet.ibm.com>
This commit is contained in:
Stefan Berger 2019-07-26 16:56:32 -04:00 committed by Eric Blake
parent 9b4bc79549
commit 4f5fff8735
2 changed files with 3 additions and 2 deletions

View File

@ -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;

View File

@ -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);