Skip to content

Commit

Permalink
Drop designated initializers
Browse files Browse the repository at this point in the history
We may not support C99 designated initializers. Thus, drop it.
  • Loading branch information
jserv committed Jul 25, 2023
1 parent d374993 commit adc6b38
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,32 +160,6 @@ typedef struct {
} route_info_t;
```

### Initialization

Embrace C99 structure initialization where reasonable, e.g.,
```c
static const crypto_ops_t openssl_ops = {
.create = openssl_crypto_create,
.destroy = openssl_crypto_destroy,
.encrypt = openssl_crypto_encrypt,
.decrypt = openssl_crypto_decrypt,
.hmac = openssl_crypto_hmac,
};
```

Embrace C99 array initialization, especially for the state machines, e.g.,
```c
static const uint8_t tcp_fsm[TCP_NSTATES][2][TCPFC_COUNT] = {
[TCPS_CLOSED] = {
[FLOW_FORW] = {
/* Handshake (1): initial SYN. */
[TCPFC_SYN] = TCPS_SYN_SENT,
},
},
...
}
```

### Control structures

Try to make the control flow easy to follow. Avoid long convoluted logic
Expand Down

0 comments on commit adc6b38

Please sign in to comment.