Skip to content
Snippets Groups Projects
Commit 0ed7b165 authored by hoelscher's avatar hoelscher
Browse files

Modify codestyle

parent 9a4b2aee
No related branches found
No related tags found
No related merge requests found
...@@ -2277,34 +2277,34 @@ pollfd ...@@ -2277,34 +2277,34 @@ pollfd
; ;
opt_revents opt_revents
: { $$ = new_integer_expression(0, "%ld" ); } : { $$ = new_integer_expression(0, "%ld"); }
| ',' REVENTS '=' expression { $$ = $4; } | ',' REVENTS '=' expression { $$ = $4; }
; ;
l_onoff l_onoff
: ONOFF '=' INTEGER { : ONOFF '=' INTEGER {
if (!is_valid_s32($3)){ if (!is_valid_s32($3)) {
semantic_error("linger onoff out of range"); semantic_error("linger onoff out of range");
} else { } else {
$$ = new_integer_expression( $3, "%ld" ); $$ = new_integer_expression($3, "%ld");
} }
} }
| ONOFF '=' ELLIPSIS { $$ = new_expression( EXPR_ELLIPSIS ); } | ONOFF '=' ELLIPSIS { $$ = new_expression(EXPR_ELLIPSIS); }
; ;
l_linger l_linger
: LINGER '=' INTEGER { : LINGER '=' INTEGER {
if (!is_valid_s32($3)){ if (!is_valid_s32($3)) {
semantic_error("linger out of range"); semantic_error("linger out of range");
} }
$$ = new_integer_expression( $3, "%ld"); $$ = new_integer_expression($3, "%ld");
} }
| LINGER '=' ELLIPSIS { $$ = new_expression( EXPR_ELLIPSIS ); } | LINGER '=' ELLIPSIS { $$ = new_expression(EXPR_ELLIPSIS); }
; ;
linger linger
: '{' l_onoff ',' l_linger '}' { : '{' l_onoff ',' l_linger '}' {
$$ = new_expression( EXPR_LINGER ); $$ = new_expression(EXPR_LINGER);
$$->value.linger = (struct linger_expr*) calloc(1, sizeof(struct linger_expr)); $$->value.linger = (struct linger_expr*) calloc(1, sizeof(struct linger_expr));
$$->value.linger->l_onoff = $2; $$->value.linger->l_onoff = $2;
$$->value.linger->l_linger = $4; $$->value.linger->l_linger = $4;
...@@ -2316,9 +2316,9 @@ srto_initial ...@@ -2316,9 +2316,9 @@ srto_initial
if (!is_valid_u32($3)){ if (!is_valid_u32($3)){
semantic_error("srto_initial out of range"); semantic_error("srto_initial out of range");
} }
$$ = new_integer_expression( $3, "%u"); $$ = new_integer_expression($3, "%u");
} }
| SRTO_INITIAL '=' ELLIPSIS { $$ = new_expression( EXPR_ELLIPSIS ); } | SRTO_INITIAL '=' ELLIPSIS { $$ = new_expression(EXPR_ELLIPSIS); }
; ;
srto_max srto_max
...@@ -2326,9 +2326,9 @@ srto_max ...@@ -2326,9 +2326,9 @@ srto_max
if (!is_valid_u32($3)) { if (!is_valid_u32($3)) {
semantic_error("srto_max out of range"); semantic_error("srto_max out of range");
} }
$$ = new_integer_expression( $3, "%u"); $$ = new_integer_expression($3, "%u");
} }
| SRTO_MAX '=' ELLIPSIS { $$ = new_expression( EXPR_ELLIPSIS ); } | SRTO_MAX '=' ELLIPSIS { $$ = new_expression(EXPR_ELLIPSIS); }
; ;
srto_min srto_min
...@@ -2336,9 +2336,9 @@ srto_min ...@@ -2336,9 +2336,9 @@ srto_min
if (!is_valid_u32($3)) { if (!is_valid_u32($3)) {
semantic_error("srto_min out of range"); semantic_error("srto_min out of range");
} }
$$ = new_integer_expression( $3, "%u"); $$ = new_integer_expression($3, "%u");
} }
| SRTO_MIN '=' ELLIPSIS { $$ = new_expression( EXPR_ELLIPSIS ); } | SRTO_MIN '=' ELLIPSIS { $$ = new_expression(EXPR_ELLIPSIS); }
; ;
sctp_rtoinfo sctp_rtoinfo
......
...@@ -1586,7 +1586,7 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall, ...@@ -1586,7 +1586,7 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall,
live_optlen = (socklen_t)sizeof(struct linger); live_optlen = (socklen_t)sizeof(struct linger);
#ifdef SCTP_RTOINFO #ifdef SCTP_RTOINFO
} else if (val_expression->type == EXPR_SCTP_RTOINFO) { } else if (val_expression->type == EXPR_SCTP_RTOINFO) {
live_optval = calloc(1, sizeof(struct sctp_rtoinfo)); live_optval = malloc(sizeof(struct sctp_rtoinfo));
live_optlen = (socklen_t)sizeof(struct sctp_rtoinfo); live_optlen = (socklen_t)sizeof(struct sctp_rtoinfo);
((struct sctp_rtoinfo*)live_optval)->srto_assoc_id = 0; ((struct sctp_rtoinfo*)live_optval)->srto_assoc_id = 0;
#endif #endif
...@@ -1764,7 +1764,7 @@ static int syscall_setsockopt(struct state *state, struct syscall_spec *syscall, ...@@ -1764,7 +1764,7 @@ static int syscall_setsockopt(struct state *state, struct syscall_spec *syscall,
if (val_expression == NULL) if (val_expression == NULL)
return STATUS_ERR; return STATUS_ERR;
if (val_expression->type == EXPR_LINGER) { if (val_expression->type == EXPR_LINGER) {
optval = malloc( sizeof( struct linger )); optval = malloc(sizeof(struct linger));
get_s32(val_expression->value.linger->l_onoff, get_s32(val_expression->value.linger->l_onoff,
&(((struct linger*) optval)->l_onoff), error); &(((struct linger*) optval)->l_onoff), error);
get_s32(val_expression->value.linger->l_linger, get_s32(val_expression->value.linger->l_linger,
...@@ -1777,17 +1777,20 @@ static int syscall_setsockopt(struct state *state, struct syscall_spec *syscall, ...@@ -1777,17 +1777,20 @@ static int syscall_setsockopt(struct state *state, struct syscall_spec *syscall,
optval = &optval_s32; optval = &optval_s32;
#ifdef SCTP_RTOINFO #ifdef SCTP_RTOINFO
} else if (val_expression->type == EXPR_SCTP_RTOINFO) { } else if (val_expression->type == EXPR_SCTP_RTOINFO) {
if (val_expression->value.sctp_rtoinfo->srto_initial->type != EXPR_INTEGER || struct sctp_rtoinfo *rtoinfo;
val_expression->value.sctp_rtoinfo->srto_max->type != EXPR_INTEGER || struct sctp_rtoinfo_expr *expr_rtoinfo = val_expression->value.sctp_rtoinfo;
val_expression->value.sctp_rtoinfo->srto_min->type != EXPR_INTEGER) { if (expr_rtoinfo->srto_initial->type != EXPR_INTEGER ||
expr_rtoinfo->srto_max->type != EXPR_INTEGER ||
expr_rtoinfo->srto_min->type != EXPR_INTEGER) {
asprintf(error, "Bad setsockopt, bad inputtype for rtoinfo"); asprintf(error, "Bad setsockopt, bad inputtype for rtoinfo");
return STATUS_ERR; return STATUS_ERR;
} }
optval = malloc(sizeof(struct sctp_rtoinfo)); rtoinfo = malloc(sizeof(struct sctp_rtoinfo));
((struct sctp_rtoinfo*) optval)->srto_initial = val_expression->value.sctp_rtoinfo->srto_initial->value.num; rtoinfo->srto_initial = expr_rtoinfo->srto_initial->value.num;
((struct sctp_rtoinfo*) optval)->srto_max = val_expression->value.sctp_rtoinfo->srto_max->value.num; rtoinfo->srto_max = expr_rtoinfo->srto_max->value.num;
((struct sctp_rtoinfo*) optval)->srto_min = val_expression->value.sctp_rtoinfo->srto_min->value.num; rtoinfo->srto_min = expr_rtoinfo->srto_min->value.num;
((struct sctp_rtoinfo*) optval)->srto_assoc_id = 0; rtoinfo->srto_assoc_id = 0;
optval = rtoinfo;
#endif #endif
#ifdef SCTP_INITMSG #ifdef SCTP_INITMSG
} else if (val_expression->type == EXPR_SCTP_INITMSG) { } else if (val_expression->type == EXPR_SCTP_INITMSG) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment