From e2bd9bb192a4652e8a2900faa090434bbb61cfde Mon Sep 17 00:00:00 2001 From: =?utf8?q?Dominic=20Sacr=C3=A9?= Date: Mon, 11 May 2015 17:49:43 +0200 Subject: [PATCH] libusbgx: Format switch statements more consistently MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Insert blank lines between all cases in switch statements that branch on attribute types. Signed-off-by: Dominic Sacré Reviewed-by: Pawel Szewczyk [Update description] Signed-off-by: Krzysztof Opasiak --- examples/show-gadgets.c | 4 ++++ src/usbg.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/examples/show-gadgets.c b/examples/show-gadgets.c index aa4275c..7ff71d5 100644 --- a/examples/show-gadgets.c +++ b/examples/show-gadgets.c @@ -104,6 +104,7 @@ void show_function(usbg_function *f) fprintf(stdout, " Function, type: %s instance: %s\n", usbg_get_function_type_str(type), instance); + switch (f_attrs.header.attrs_type) { case USBG_F_ATTRS_SERIAL: fprintf(stdout, " port_num\t\t%d\n", @@ -122,6 +123,7 @@ void show_function(usbg_function *f) fprintf(stdout, " qmult\t\t%d\n", f_net_attrs->qmult); break; } + case USBG_F_ATTRS_PHONET: fprintf(stdout, " ifname\t\t%s\n", f_attrs.attrs.phonet.ifname); break; @@ -129,6 +131,7 @@ void show_function(usbg_function *f) case USBG_F_ATTRS_FFS: fprintf(stdout, " dev_name\t\t%s\n", f_attrs.attrs.ffs.dev_name); break; + case USBG_F_ATTRS_MS: { usbg_f_ms_attrs *attrs = &f_attrs.attrs.ms; @@ -146,6 +149,7 @@ void show_function(usbg_function *f) } break; } + default: fprintf(stdout, " UNKNOWN\n"); } diff --git a/src/usbg.c b/src/usbg.c index 4d0beed..385a862 100644 --- a/src/usbg.c +++ b/src/usbg.c @@ -1093,6 +1093,7 @@ static int usbg_parse_function_attrs(usbg_function *f, ret = USBG_SUCCESS; break; } + case USBG_F_ATTRS_MS: f_attrs->header.attrs_type = USBG_F_ATTRS_MS; ret = usbg_parse_function_ms_attrs(f, &(f_attrs->attrs.ms)); @@ -2898,6 +2899,7 @@ void usbg_cleanup_function_attrs(usbg_function_attrs *f_attrs) free(attrs->ffs.dev_name); attrs->ffs.dev_name = NULL; break; + case USBG_F_ATTRS_MS: { int i; @@ -2919,6 +2921,7 @@ void usbg_cleanup_function_attrs(usbg_function_attrs *f_attrs) ms_break: break; } + default: ERROR("Unsupported attrs type\n"); break; @@ -3162,9 +3165,11 @@ int usbg_set_function_attrs(usbg_function *f, ret = f_attrs->attrs.ffs.dev_name && f_attrs->attrs.ffs.dev_name[0] ? USBG_ERROR_INVALID_PARAM : USBG_SUCCESS; break; + case USBG_F_ATTRS_MS: ret = usbg_set_function_ms_attrs(f, &f_attrs->attrs.ms); break; + default: ERROR("Unsupported function type\n"); ret = USBG_ERROR_NOT_SUPPORTED; -- 2.7.4