diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/amqp_connect_timeout.c | 3 | ||||
-rw-r--r-- | examples/amqp_rpc_sendstring_client.c | 2 | ||||
-rw-r--r-- | examples/amqps_connect_timeout.c | 6 |
3 files changed, 5 insertions, 6 deletions
diff --git a/examples/amqp_connect_timeout.c b/examples/amqp_connect_timeout.c index c2bd5ec..03eddc9 100644 --- a/examples/amqp_connect_timeout.c +++ b/examples/amqp_connect_timeout.c @@ -64,6 +64,7 @@ int main(int argc, char const *const *argv) int port; amqp_socket_t *socket; amqp_connection_state_t conn; + struct timeval tval; struct timeval *tv; if (argc < 3) { @@ -72,7 +73,7 @@ int main(int argc, char const *const *argv) } if (argc > 3) { - tv = malloc(sizeof(struct timeval)); + tv = &tval; tv->tv_sec = atoi(argv[3]); diff --git a/examples/amqp_rpc_sendstring_client.c b/examples/amqp_rpc_sendstring_client.c index 5b1ebfc..fdca18a 100644 --- a/examples/amqp_rpc_sendstring_client.c +++ b/examples/amqp_rpc_sendstring_client.c @@ -168,7 +168,7 @@ int main(int argc, char *argv[]) break; } - printf("Frame type: %d channel: %d\n", frame.frame_type, frame.channel); + printf("Frame type: %u channel: %u\n", frame.frame_type, frame.channel); if (frame.frame_type != AMQP_FRAME_METHOD) { continue; } diff --git a/examples/amqps_connect_timeout.c b/examples/amqps_connect_timeout.c index 81e1e91..972c2f7 100644 --- a/examples/amqps_connect_timeout.c +++ b/examples/amqps_connect_timeout.c @@ -68,6 +68,7 @@ int main(int argc, char const *const *argv) int timeout; amqp_socket_t *socket; amqp_connection_state_t conn; + struct timeval tval; struct timeval *tv; if (argc < 3) { @@ -83,10 +84,7 @@ int main(int argc, char const *const *argv) timeout = atoi(argv[3]); if (timeout > 0) { - tv = malloc(sizeof(struct timeval)); - if (tv == NULL) { - die("failed to malloc struct timeval"); - } + tv = &tval; tv->tv_sec = timeout; tv->tv_usec = 0; |