switch/case formatting style

This commit is contained in:
Richard Aas 2011-05-09 11:00:25 +00:00
parent a0c2f8bcfa
commit 2ce9da5fa8
9 changed files with 19 additions and 0 deletions

View file

@ -144,7 +144,9 @@ static void dbg_vprintf(int level, const char *fmt, va_list ap)
dbg_lock();
if (dbg.flags & DBG_ANSI) {
switch (level) {
case DBG_WARNING:
(void)re_fprintf(stderr, "\x1b[31m"); /* Red */
break;

View file

@ -119,6 +119,7 @@ static int rt_parse(const struct nlmsghdr *nlhdr, struct net_rt *rt)
case RTA_GATEWAY:
switch (rtmsg->rtm_family) {
case AF_INET:
sa_init(&rt->gw, AF_INET);
rt->gw.u.in.sin_addr.s_addr
@ -146,6 +147,7 @@ static int rt_parse(const struct nlmsghdr *nlhdr, struct net_rt *rt)
case RTA_DST:
switch (rtmsg->rtm_family) {
case AF_INET:
sa_init(&rt->dst, AF_INET);
rt->dst.u.in.sin_addr.s_addr

View file

@ -62,6 +62,7 @@ int net_if_debug(struct re_printf *pf, void *unused)
err |= re_hprintf(pf, "Interface Name: %s\n", buf);
switch (ifinfo().iState) {
case EIfPending: state = "Pending"; break;
case EIfUp: state = "Up"; break;
case EIfBusy: state = "Busy"; break;

View file

@ -34,6 +34,7 @@ static struct sa local_ip;
int kerr2errno(int kerr)
{
switch (kerr) {
case KErrNone: return 0;
case KErrNotFound: return ENOENT;
case KErrGeneral: return EINVAL;

View file

@ -153,6 +153,7 @@ const char* inet_ntop(int af, const void *src, char *dst, size_t size);
const char* inet_ntop(int af, const void *src, char *dst, size_t size)
{
switch (af) {
case AF_INET:
return inet_ntop4(src, dst, size);
@ -190,6 +191,7 @@ int net_inet_ntop(const struct sa *sa, char *buf, int size)
return EINVAL;
switch (sa->u.sa.sa_family) {
case AF_INET:
inet_ntop(AF_INET, &sa->u.in.sin_addr, buf, size);
break;

View file

@ -193,6 +193,7 @@ static int inet_pton(int af, const char *src, void *dst)
return 0;
switch (af) {
case AF_INET:
return inet_pton4(src, (u_char*) dst);

View file

@ -111,6 +111,7 @@ static int a_or_aaaa_query(struct stun_dns *dns, const char *name)
dns->dq = mem_deref(dns->dq);
switch (dns->af) {
case AF_INET:
return dnsc_query(&dns->dq, dns->dnsc, name, DNS_TYPE_A,
DNS_CLASS_IN, true, a_handler, dns);
@ -158,6 +159,7 @@ static void srv_handler(int err, const struct dnshdr *hdr, struct list *ansl,
/* Look for Additional information */
switch (dns->af) {
case AF_INET:
arr = dns_rrlist_find(addl, rr->rdata.srv.target,
DNS_TYPE_A, DNS_CLASS_IN, true);

View file

@ -56,6 +56,7 @@ static int tls_connect(struct tls_conn *tc)
const int ssl_err = SSL_get_error(tc->ssl, r);
switch (ssl_err) {
case SSL_ERROR_WANT_READ:
break;
@ -80,6 +81,7 @@ static int tls_accept(struct tls_conn *tc)
const int ssl_err = SSL_get_error(tc->ssl, r);
switch (ssl_err) {
case SSL_ERROR_WANT_READ:
break;
@ -166,6 +168,7 @@ static bool recv_handler(int *err, struct mbuf *mb, bool *estab, void *arg)
const int ssl_err = SSL_get_error(tc->ssl, n);
switch (ssl_err) {
case SSL_ERROR_WANT_READ:
break;

View file

@ -21,6 +21,7 @@ typedef bool (esc_h)(char c);
static bool is_mark(int c)
{
switch (c) {
case '-':
case '_':
case '.':
@ -46,6 +47,7 @@ static bool is_unreserved(char c)
static bool is_user_unreserved(int c)
{
switch (c) {
case '&':
case '=':
case '+':
@ -63,6 +65,7 @@ static bool is_user_unreserved(int c)
static bool is_hnv_unreserved(char c)
{
switch (c) {
case '[':
case ']':
case '/':
@ -86,6 +89,7 @@ static bool is_user(char c)
static bool is_password(char c)
{
switch (c) {
case '&':
case '=':
case '+':
@ -101,6 +105,7 @@ static bool is_password(char c)
static bool is_param_unreserved(char c)
{
switch (c) {
case '[':
case ']':
case '/':