If you want just eliminate some gotos (and eventually warnings... you should
always enable packet signing, btw), try this one ;-) But I'm not sure
that code below is better than using goto...
Petr Vandrovec
(ncpfs maintainer)
diff -u linux-2.5.48-c903.dist/fs/ncpfs/sock.c linux-2.5.48-c903/fs/ncpfs/sock.c
--- linux-2.5.48-c903.dist/fs/ncpfs/sock.c 2002-11-19 15:28:26.000000000 +0100
+++ linux-2.5.48-c903/fs/ncpfs/sock.c 2002-11-19 22:46:39.000000000 +0100
@@ -584,10 +584,12 @@
server->rcv.len = 8;
server->rcv.state = 4;
break;
- }
+ case 4:
+ datalen = server->rcv.buf.len;
+ type = ntohs(server->rcv.buf.type2);
+ } else
#endif
type = ntohs(server->rcv.buf.type);
-cont:;
if (type != NCP_REPLY) {
if (datalen - 8 <= sizeof(server->unexpected_packet.data)) {
*(__u16*)(server->unexpected_packet.data) = htons(type);
@@ -622,12 +624,6 @@
server->rcv.len = datalen - 10;
server->rcv.state = 1;
break;
-#ifdef CONFIG_NCPFS_PACKET_SIGNING
- case 4:
- datalen = server->rcv.buf.len;
- type = ntohs(server->rcv.buf.type2);
- goto cont;
-#endif
case 1:
req = server->rcv.creq;
if (req->tx_type != NCP_ALLOC_SLOT_REQUEST) {
@@ -652,20 +648,20 @@
}
#endif
ncp_finish_request(req, req->datalen);
- nextreq:;
+ if (0) {
+ case 3:
+ ncp_finish_request(server->rcv.creq, -EIO);
+ }
__ncp_next_request(server);
+ if (0) {
+ case 5:
+ info_server(server, 0, server->unexpected_packet.data, server->unexpected_packet.len);
+ }
case 2:
- next:;
server->rcv.ptr = (unsigned char*)&server->rcv.buf;
server->rcv.len = 10;
server->rcv.state = 0;
break;
- case 3:
- ncp_finish_request(server->rcv.creq, -EIO);
- goto nextreq;
- case 5:
- info_server(server, 0, server->unexpected_packet.data, server->unexpected_packet.len);
- goto next;
}
}
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/