mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
poll: Reformat ssh_poll_ctx_resize
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
f039edd85d
commit
a85813e6e6
33
src/poll.c
33
src/poll.c
@@ -560,29 +560,30 @@ void ssh_poll_ctx_free(ssh_poll_ctx ctx)
|
||||
|
||||
static int ssh_poll_ctx_resize(ssh_poll_ctx ctx, size_t new_size)
|
||||
{
|
||||
ssh_poll_handle *pollptrs;
|
||||
ssh_pollfd_t *pollfds;
|
||||
ssh_poll_handle *pollptrs;
|
||||
ssh_pollfd_t *pollfds;
|
||||
|
||||
pollptrs = realloc(ctx->pollptrs, sizeof(ssh_poll_handle) * new_size);
|
||||
if (pollptrs == NULL) {
|
||||
return -1;
|
||||
}
|
||||
ctx->pollptrs = pollptrs;
|
||||
|
||||
pollfds = realloc(ctx->pollfds, sizeof(ssh_pollfd_t) * new_size);
|
||||
if (pollfds == NULL) {
|
||||
pollptrs = realloc(ctx->pollptrs, sizeof(ssh_poll_handle) * ctx->polls_allocated);
|
||||
pollptrs = realloc(ctx->pollptrs, sizeof(ssh_poll_handle) * new_size);
|
||||
if (pollptrs == NULL) {
|
||||
return -1;
|
||||
}
|
||||
ctx->pollptrs = pollptrs;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ctx->pollfds = pollfds;
|
||||
ctx->polls_allocated = new_size;
|
||||
pollfds = realloc(ctx->pollfds, sizeof(ssh_pollfd_t) * new_size);
|
||||
if (pollfds == NULL) {
|
||||
pollptrs = realloc(ctx->pollptrs,
|
||||
sizeof(ssh_poll_handle) * ctx->polls_allocated);
|
||||
if (pollptrs == NULL) {
|
||||
return -1;
|
||||
}
|
||||
ctx->pollptrs = pollptrs;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
ctx->pollfds = pollfds;
|
||||
ctx->polls_allocated = new_size;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user