On 05/30/2017 09:30 AM, Vladimir Sementsov-Ogievskiy wrote: > - do not goto into switch block from outer block
This sentence didn't quite make sense. Better might be: - do not use 'goto error_reply' outside a switch to jump into the middle of the switch's default case label > - reduce code duplications s/duplications/duplication/ > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> > --- > nbd/server.c | 53 ++++++++++++++++++++--------------------------------- > 1 file changed, 20 insertions(+), 33 deletions(-) > > @@ -1098,7 +1099,7 @@ static coroutine_fn void nbd_trip(void *opaque) > > if (ret < 0) { > reply.error = -ret; > - goto error_reply; > + goto reply; > } But this was indeed a case of jumping from before the switch()... > default: > LOG("invalid request type (%" PRIu32 ") received", request.type); > reply.error = EINVAL; > - error_reply: > - /* We must disconnect after NBD_CMD_WRITE if we did not > - * read the payload. > - */ ...into the middle, which, although valid C, is indeed unusual. Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature