diff options
author | Andrey Nazarov <skuller@skuller.net> | 2013-01-30 19:53:36 +0400 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2013-01-30 21:18:24 +0400 |
commit | 499a035a0235e88b0b8bbfcfc9a88d6e8ecff580 (patch) | |
tree | e9c21fbcb127a1700cbf7fa43fffd0d4604eed1d | |
parent | d72fde683f81a13fc7bdf5fbd0838d350627ef9b (diff) |
Add STRINGIFY macro. Use it where appropriate.
-rw-r--r-- | inc/common/common.h | 3 | ||||
-rw-r--r-- | inc/common/net/net.h | 2 | ||||
-rw-r--r-- | src/common/net/net.c | 4 | ||||
-rw-r--r-- | src/refresh/sw/main.c | 4 | ||||
-rw-r--r-- | src/server/main.c | 2 |
5 files changed, 8 insertions, 7 deletions
diff --git a/inc/common/common.h b/inc/common/common.h index 48e5e45..643a9f1 100644 --- a/inc/common/common.h +++ b/inc/common/common.h @@ -55,6 +55,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #define CONST_STR_LEN(x) x, x ? sizeof(x) - 1 : 0 +#define __STRINGIFY(x) #x +#define STRINGIFY(x) __STRINGIFY(x) + typedef struct { const char *name; void (* const func)(void); diff --git a/inc/common/net/net.h b/inc/common/net/net.h index cf0b1eb..187487b 100644 --- a/inc/common/net/net.h +++ b/inc/common/net/net.h @@ -24,10 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc., // net.h -- quake's interface to the networking layer #define PORT_ANY -1 -#define PORT_ANY_STRING "-1" #define PORT_MASTER 27900 #define PORT_SERVER 27910 -#define PORT_SERVER_STRING "27910" #define MIN_PACKETLEN 512 // don't allow smaller packets #define MAX_PACKETLEN 4096 // max length of a single packet diff --git a/src/common/net/net.c b/src/common/net/net.c index 3c2f63a..10e3763 100644 --- a/src/common/net/net.c +++ b/src/common/net/net.c @@ -1591,10 +1591,10 @@ void NET_Init(void) net_ip = Cvar_Get("net_ip", "", 0); net_ip->changed = net_udp_param_changed; - net_port = Cvar_Get("net_port", PORT_SERVER_STRING, 0); + net_port = Cvar_Get("net_port", STRINGIFY(PORT_SERVER), 0); net_port->changed = net_udp_param_changed; #if USE_CLIENT - net_clientport = Cvar_Get("net_clientport", PORT_ANY_STRING, 0); + net_clientport = Cvar_Get("net_clientport", STRINGIFY(PORT_ANY), 0); net_clientport->changed = net_udp_param_changed; net_dropsim = Cvar_Get("net_dropsim", "0", 0); #endif diff --git a/src/refresh/sw/main.c b/src/refresh/sw/main.c index 5e214df..1316f12 100644 --- a/src/refresh/sw/main.c +++ b/src/refresh/sw/main.c @@ -186,8 +186,8 @@ void R_Register(void) sw_clearcolor = Cvar_Get("sw_clearcolor", "2", 0); sw_drawflat = Cvar_Get("sw_drawflat", "0", CVAR_CHEAT); sw_draworder = Cvar_Get("sw_draworder", "0", CVAR_CHEAT); - sw_maxedges = Cvar_Get("sw_maxedges", va("%i", NUMSTACKEDGES), 0); - sw_maxsurfs = Cvar_Get("sw_maxsurfs", va("%i", NUMSTACKSURFACES), 0); + sw_maxedges = Cvar_Get("sw_maxedges", STRINGIFY(NUMSTACKEDGES), 0); + sw_maxsurfs = Cvar_Get("sw_maxsurfs", STRINGIFY(NUMSTACKSURFACES), 0); sw_mipcap = Cvar_Get("sw_mipcap", "0", 0); sw_mipscale = Cvar_Get("sw_mipscale", "1", 0); sw_reportedgeout = Cvar_Get("sw_reportedgeout", "0", 0); diff --git a/src/server/main.c b/src/server/main.c index fd1edf4..377bec7 100644 --- a/src/server/main.c +++ b/src/server/main.c @@ -1992,7 +1992,7 @@ void SV_Init(void) SV_RegisterSavegames(); - Cvar_Get("protocol", va("%i", PROTOCOL_VERSION_DEFAULT), CVAR_SERVERINFO | CVAR_ROM); + Cvar_Get("protocol", STRINGIFY(PROTOCOL_VERSION_DEFAULT), CVAR_SERVERINFO | CVAR_ROM); Cvar_Get("skill", "1", CVAR_LATCH); Cvar_Get("deathmatch", "1", CVAR_SERVERINFO | CVAR_LATCH); |