
3 Feb
2012
3 Feb
'12
1:37 p.m.
On Thursday 19 January 2012 19:53:25 Joe Hershberger wrote:
--- a/include/net.h +++ b/include/net.h
-extern int NetLoop(enum proto_t); +extern int NetLoop(enum proto_t protocol);
explicit variable names are unnecessary when the type is self explanatory
--- a/net/net.c +++ b/net/net.c
-static void NetInitLoop(enum proto_t protocol) +static void NetInitLoop(void)
this could prob do with a sep patch ...
+void +NetInit(void) +{
- static int first_call = 1;
- if (first_call) {
/*
* Setup packet buffers, aligned correctly.
*/
int i;
NetTxPacket = &PktBuf[0] + (PKTALIGN - 1);
NetTxPacket -= (ulong)NetTxPacket % PKTALIGN;
for (i = 0; i < PKTBUFSRX; i++)
NetRxPackets[i] = NetTxPacket + (i+1)*PKTSIZE_ALIGN;
ArpInit();
/* Only need to setup buffer pointers once. */
first_call = 0;
- }
it *seems* like it should be fine, but i worry what might be lurking. guess we'll find out :P.
@@ -627,6 +639,12 @@ NetSendUDPPacket
- /* make sure the NetTxPacket is initialized (NetInit() was called) */
- if (NetTxPacket == NULL) {
puts("*** ERROR: NetTxPacket buffer pointer is NULL!\n");
return -1;
- }
why check here only (udp) ? and why check at all ? this should be an assert() in the comment netsendpacket entry point ... -mike