mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
virCommandSetSendBuffer: Take double pointer of @buffer
The virCommandSetSendBuffer() function consumes passed @buffer, but takes it only as plain pointer. Switch to a double pointer to make this obvious. This allows us then to drop all g_steal_pointer() in callers. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
5690c9594e
commit
5c1b5f208a
@ -265,7 +265,7 @@ qemuTPMSetupEncryption(const unsigned char *secretuuid,
|
|||||||
&secret, &secret_len) < 0)
|
&secret, &secret_len) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
*fd = virCommandSetSendBuffer(cmd, g_steal_pointer(&secret), secret_len);
|
*fd = virCommandSetSendBuffer(cmd, &secret, secret_len);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1699,10 +1699,10 @@ virCommandFreeSendBuffers(virCommand *cmd)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
virCommandSetSendBuffer(virCommand *cmd,
|
virCommandSetSendBuffer(virCommand *cmd,
|
||||||
unsigned char *buffer,
|
unsigned char **buffer,
|
||||||
size_t buflen)
|
size_t buflen)
|
||||||
{
|
{
|
||||||
g_autofree unsigned char *localbuf = g_steal_pointer(&buffer);
|
g_autofree unsigned char *localbuf = g_steal_pointer(buffer);
|
||||||
int pipefd[2] = { -1, -1 };
|
int pipefd[2] = { -1, -1 };
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -2901,7 +2901,7 @@ int virCommandHandshakeNotify(virCommand *cmd)
|
|||||||
#else /* WIN32 */
|
#else /* WIN32 */
|
||||||
int
|
int
|
||||||
virCommandSetSendBuffer(virCommand *cmd,
|
virCommandSetSendBuffer(virCommand *cmd,
|
||||||
unsigned char *buffer G_GNUC_UNUSED,
|
unsigned char **buffer G_GNUC_UNUSED,
|
||||||
size_t buflen G_GNUC_UNUSED)
|
size_t buflen G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
if (virCommandHasError(cmd))
|
if (virCommandHasError(cmd))
|
||||||
|
@ -132,7 +132,7 @@ void virCommandSetWorkingDirectory(virCommand *cmd,
|
|||||||
const char *pwd) ATTRIBUTE_NONNULL(2);
|
const char *pwd) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
int virCommandSetSendBuffer(virCommand *cmd,
|
int virCommandSetSendBuffer(virCommand *cmd,
|
||||||
unsigned char *buffer,
|
unsigned char **buffer,
|
||||||
size_t buflen)
|
size_t buflen)
|
||||||
ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
|
@ -1075,8 +1075,8 @@ static int test27(const void *unused G_GNUC_UNUSED)
|
|||||||
errexpect = g_strdup_printf(TEST27_ERREXPECT_TEMP,
|
errexpect = g_strdup_printf(TEST27_ERREXPECT_TEMP,
|
||||||
buffer0, buffer1, buffer2);
|
buffer0, buffer1, buffer2);
|
||||||
|
|
||||||
buf1fd = virCommandSetSendBuffer(cmd, g_steal_pointer(&buffer1), buflen - 1);
|
buf1fd = virCommandSetSendBuffer(cmd, &buffer1, buflen - 1);
|
||||||
buf2fd = virCommandSetSendBuffer(cmd, g_steal_pointer(&buffer2), buflen - 1);
|
buf2fd = virCommandSetSendBuffer(cmd, &buffer2, buflen - 1);
|
||||||
|
|
||||||
virCommandAddArg(cmd, "--readfd");
|
virCommandAddArg(cmd, "--readfd");
|
||||||
virCommandAddArgFormat(cmd, "%d", buf1fd);
|
virCommandAddArgFormat(cmd, "%d", buf1fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user