Browse code

topoh: convert to memory logging helper

Henning Westerholt authored on 13/02/2020 21:56:38
Showing 3 changed files
... ...
@@ -98,7 +98,7 @@ char* th_mask_encode(char *in, int ilen, str *prefix, int *olen)
98 98
 	out = (char*)pkg_malloc((*olen+1)*sizeof(char));
99 99
 	if(out==NULL)
100 100
 	{
101
-		LM_ERR("no more pkg\n");
101
+		PKG_MEM_ERROR;
102 102
 		*olen = 0;
103 103
 		return NULL;
104 104
 	}
... ...
@@ -151,7 +151,7 @@ char* th_mask_decode(char *in, int ilen, str *prefix, int extra, int *olen)
151 151
 
152 152
 	if(out==NULL)
153 153
 	{
154
-		LM_ERR("no more pkg\n");
154
+		PKG_MEM_ERROR;
155 155
 		*olen = 0;
156 156
 		return NULL;
157 157
 	}
... ...
@@ -294,7 +294,7 @@ int th_mask_contact(sip_msg_t *msg)
294 294
 		p = (char*)pkg_malloc(out.len+3);
295 295
 		if(p==NULL)
296 296
 		{
297
-			LM_ERR("failed to get more pkg\n");
297
+			PKG_MEM_ERROR;
298 298
 			pkg_free(out.s);
299 299
 			return -1;
300 300
 		}
... ...
@@ -441,7 +441,7 @@ int th_unmask_via(sip_msg_t *msg, str *cookie)
441 441
 					via2=pkg_malloc(sizeof(struct via_body));
442 442
 					if (via2==0)
443 443
 					{
444
-						LM_ERR("out of memory\n");
444
+						PKG_MEM_ERROR;
445 445
 						pkg_free(out.s);
446 446
 						return -1;
447 447
 
... ...
@@ -983,7 +983,7 @@ int th_add_via_cookie(sip_msg_t *msg, struct via_body *via)
983 983
 	out.s = (char*)pkg_malloc(out.len+1);
984 984
 	if(out.s==0)
985 985
 	{
986
-		LM_ERR("no pkg memory\n");
986
+		PKG_MEM_ERROR;
987 987
 		return -1;
988 988
 	}
989 989
 	out.s[0] = ';';
... ...
@@ -1009,7 +1009,7 @@ int th_add_hdr_cookie(sip_msg_t *msg)
1009 1009
 	h.s = (char*)pkg_malloc(h.len+1);
1010 1010
 	if(h.s == 0)
1011 1011
 	{
1012
-		LM_ERR("no more pkg\n");
1012
+		PKG_MEM_ERROR;
1013 1013
 		return -1;
1014 1014
 	}
1015 1015
 	anchor = anchor_lump(msg, msg->unparsed - msg->buf, 0, 0);
... ...
@@ -186,7 +186,7 @@ static int mod_init(void)
186 186
 	th_via_prefix.s = (char*)pkg_malloc(th_via_prefix.len+1);
187 187
 	if(th_via_prefix.s==NULL)
188 188
 	{
189
-		LM_ERR("via prefix parameter is invalid\n");
189
+		PKG_MEM_ERROR_FMT("via prefix parameter\n");
190 190
 		goto error;
191 191
 	}
192 192
 	/* 'sip:' + ip + ';' + param + '=' + prefix (+ '\0') */
... ...
@@ -195,7 +195,7 @@ static int mod_init(void)
195 195
 	th_uri_prefix.s = (char*)pkg_malloc(th_uri_prefix.len+1);
196 196
 	if(th_uri_prefix.s==NULL)
197 197
 	{
198
-		LM_ERR("uri prefix parameter is invalid\n");
198
+		PKG_MEM_ERROR_FMT("uri prefix parameter\n");
199 199
 		goto error;
200 200
 	}
201 201
 	/* build via prefix */