[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Stats and code readability
From: |
Zschocke, Florian |
Subject: |
[lwip-users] Stats and code readability |
Date: |
Wed, 18 Jun 2003 14:46:41 +0200 |
The code is filles with lines like these:
#ifdef UDP_STATS
++lwip_stats.udp.xmit;
#endif /* UDP_STATS */
Couldn't we instead define macros:
#if LWIP_STATS
# define INC_xxx_STATS(var) do{++var;}while(0)
# define DEC_xxx_STATS(var) do{--var;}while(0)
# define SET_xxx_STATS(var,val) do{var=(val);}while(0)
#else
# define INC_xxx_STATS(var)
# define DEC_xxx_STATS(var)
# define SET_xxx_STATS(var,val)
#endif
and then simply use lines like this in the code?
INC_UDP_STATS(lwip_stats.udp.xmit);
Or maybe even INC_UDP_STATS(xmit); with
# define INC_UDP_STATS(var) do{++lwip_stats.udp.var;}while(0)
I think that would add a lot to code readability, doin away with most of the
#if xxx_STATS directives in the code.
Florian.
- [lwip-users] Stats and code readability,
Zschocke, Florian <=
- Re: [lwip-users] Stats and code readability, Ed Sutter, 2003/06/18
- Re: [lwip-users] Stats and code readability, Kieran Mansley, 2003/06/18
- Re: [lwip-users] Stats and code readability, Marc Boucher, 2003/06/18
- Re: [lwip-users] Stats and code readability, Leon Woestenberg, 2003/06/18
- Re: [lwip-users] Stats and code readability, Marc Boucher, 2003/06/18
- Re: [lwip-users] Stats and code readability, Leon Woestenberg, 2003/06/18
- Re: [lwip-users] Stats and code readability, Marc Boucher, 2003/06/19