Browse code

Let compiler do the hard work and calculate the lengths of macros.

Jan Janak authored on 02/09/2004 14:29:45
Showing 1 changed files
... ...
@@ -67,7 +67,7 @@
67 67
 #define MAX_URI_SIZE 1024	/* used when rewriting URIs */
68 68
 
69 69
 #define MY_VIA "Via: SIP/2.0/UDP "
70
-#define MY_VIA_LEN 17
70
+#define MY_VIA_LEN (sizeof(MY_VIA) - 1)
71 71
 
72 72
 #define CONTENT_LENGTH "Content-Length: "
73 73
 #define CONTENT_LENGTH_LEN (sizeof(CONTENT_LENGTH)-1)
... ...
@@ -83,35 +83,37 @@
83 83
 #define MAX_WARNING_LEN  256
84 84
 		
85 85
 #define MY_BRANCH ";branch="
86
-#define MY_BRANCH_LEN 8
87
-
86
+#define MY_BRANCH_LEN (sizeof(MY_BRANCH) - 1)
88 87
 
89 88
 #define MAX_PORT_LEN 7 /* ':' + max 5 letters + \0 */
90 89
 #define CRLF "\r\n"
91
-#define CRLF_LEN 2
90
+#define CRLF_LEN (sizeof(CRLF) - 1)
92 91
 
93 92
 #define RECEIVED        ";received="
94
-#define RECEIVED_LEN 10
93
+#define RECEIVED_LEN (sizeof(RECEIVED) - 1)
95 94
 
96 95
 #define TRANSPORT_PARAM ";transport="
97
-#define TRANSPORT_PARAM_LEN 11
96
+#define TRANSPORT_PARAM_LEN (sizeof(TRANSPORT_PARAM) - 1)
98 97
 
99 98
 #define TOTAG_TOKEN ";tag="
100 99
 #define TOTAG_TOKEN_LEN (sizeof(TOTAG_TOKEN)-1)
101 100
 
102 101
 #define RPORT ";rport="
103
-#define RPORT_LEN 7
102
+#define RPORT_LEN (sizeof(RPORT) - 1)
104 103
 
105 104
 #define ID_PARAM ";i="
106
-#define ID_PARAM_LEN 3
105
+#define ID_PARAM_LEN (sizeof(ID_PARAM) - 1)
107 106
 
108 107
 #define SRV_UDP_PREFIX "_sip._udp."
108
+#define SRV_UDP_PREFIX_LEN (sizeof(SRV_UDP_PREFIX) - 1)
109
+
109 110
 #define SRV_TCP_PREFIX "_sip._tcp."
111
+#define SRV_TCP_PREFIX_LEN (sizeof(SRV_TCP_PREFIX) - 1)
112
+
110 113
 #define SRV_TLS_PREFIX "_sips._tcp."
111
-#define SRV_UDP_PREFIX_LEN 10
112
-#define SRV_TCP_PREFIX_LEN 10
113
-#define SRV_TLS_PREFIX_LEN 11
114
-#define SRV_MAX_PREFIX_LEN 11
114
+#define SRV_TLS_PREFIX_LEN (sizeof(SRV_TLS_PREFIX) - 1)
115
+
116
+#define SRV_MAX_PREFIX_LEN SRV_TLS_PREFIX_LEN
115 117
 
116 118
 /*used only if PKG_MALLOC is defined*/
117 119
 #define PKG_MEM_POOL_SIZE 1024*1024