From 5b36f754a53d66aea215a849b82416b28c01146c Mon Sep 17 00:00:00 2001 From: hoelscher <jens.hoelscher@fh-muenster.de> Date: Tue, 20 Oct 2015 11:01:06 +0200 Subject: [PATCH] styling --- gtests/net/packetdrill/run_system_call.c | 61 ++++++++++++------------ 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/gtests/net/packetdrill/run_system_call.c b/gtests/net/packetdrill/run_system_call.c index 198cfd25..0f2d7c83 100644 --- a/gtests/net/packetdrill/run_system_call.c +++ b/gtests/net/packetdrill/run_system_call.c @@ -414,6 +414,36 @@ static int get_sockstorage_arg(struct expression *arg, struct sockaddr_storage * } #endif +int check_u16_expr(struct expression *expr, u16 value, char *val_name, char **error) { + if (expr->type != EXPR_ELLIPSIS) { + u16 script_val; + + if (get_u16(expr, &script_val, error)) { + return STATUS_ERR; + } + if (script_val != value) { + asprintf(error, "%s: expected: %hu actual: %hu", val_name, script_val, value); + return STATUS_ERR; + } + } + return STATUS_OK; +} + +int check_u32_expr(struct expression *expr, u16 value, char *val_name, char **error) { + if (expr->type != EXPR_ELLIPSIS) { + u32 script_val; + + if (get_u32(expr, &script_val, error)) { + return STATUS_ERR; + } + if (script_val != value) { + asprintf(error, "%s: expected: %u actual: %u", val_name, script_val, value); + return STATUS_ERR; + } + } + return STATUS_OK; +} + /* Free all the space used by the given iovec. */ static void iovec_free(struct iovec *iov, size_t iov_len) { @@ -3728,37 +3758,6 @@ static int syscall_sctp_sendv(struct state *state, struct syscall_spec *syscall, #endif } -int check_u16_expr(struct expression *expr, u16 value, char *val_name, char **error) { - if (expr->type != EXPR_ELLIPSIS) { - u16 script_val; - - if (get_u16(expr, &script_val, error)) { - return STATUS_ERR; - } - if (script_val != value) { - asprintf(error, "%s: expected: %hu actual: %hu", val_name, script_val, value); - return STATUS_ERR; - } - } - return STATUS_OK; -} - -int check_u32_expr(struct expression *expr, u16 value, char *val_name, char **error) { - if (expr->type != EXPR_ELLIPSIS) { - u32 script_val; - - if (get_u32(expr, &script_val, error)) { - return STATUS_ERR; - } - if (script_val != value) { - asprintf(error, "%s: expected: %u actual: %u", val_name, script_val, value); - return STATUS_ERR; - } - } - return STATUS_OK; -} - - #if defined(__FreeBSD__) static int check_sctp_rcvinfo(struct sctp_rcvinfo_expr *expr, struct sctp_rcvinfo *sctp_rcvinfo, -- GitLab