Просмотр исходного кода

topoh: convert to memory logging helper

Henning Westerholt 5 лет назад
Родитель
Сommit
32c917f6a9
3 измененных файлов с 8 добавлено и 8 удалено
  1. 2 2
      src/modules/topoh/th_mask.c
  2. 4 4
      src/modules/topoh/th_msg.c
  3. 2 2
      src/modules/topoh/topoh_mod.c

+ 2 - 2
src/modules/topoh/th_mask.c

@@ -98,7 +98,7 @@ char* th_mask_encode(char *in, int ilen, str *prefix, int *olen)
 	out = (char*)pkg_malloc((*olen+1)*sizeof(char));
 	if(out==NULL)
 	{
-		LM_ERR("no more pkg\n");
+		PKG_MEM_ERROR;
 		*olen = 0;
 		return NULL;
 	}
@@ -151,7 +151,7 @@ char* th_mask_decode(char *in, int ilen, str *prefix, int extra, int *olen)
 
 	if(out==NULL)
 	{
-		LM_ERR("no more pkg\n");
+		PKG_MEM_ERROR;
 		*olen = 0;
 		return NULL;
 	}

+ 4 - 4
src/modules/topoh/th_msg.c

@@ -294,7 +294,7 @@ int th_mask_contact(sip_msg_t *msg)
 		p = (char*)pkg_malloc(out.len+3);
 		if(p==NULL)
 		{
-			LM_ERR("failed to get more pkg\n");
+			PKG_MEM_ERROR;
 			pkg_free(out.s);
 			return -1;
 		}
@@ -441,7 +441,7 @@ int th_unmask_via(sip_msg_t *msg, str *cookie)
 					via2=pkg_malloc(sizeof(struct via_body));
 					if (via2==0)
 					{
-						LM_ERR("out of memory\n");
+						PKG_MEM_ERROR;
 						pkg_free(out.s);
 						return -1;
 
@@ -983,7 +983,7 @@ int th_add_via_cookie(sip_msg_t *msg, struct via_body *via)
 	out.s = (char*)pkg_malloc(out.len+1);
 	if(out.s==0)
 	{
-		LM_ERR("no pkg memory\n");
+		PKG_MEM_ERROR;
 		return -1;
 	}
 	out.s[0] = ';';
@@ -1009,7 +1009,7 @@ int th_add_hdr_cookie(sip_msg_t *msg)
 	h.s = (char*)pkg_malloc(h.len+1);
 	if(h.s == 0)
 	{
-		LM_ERR("no more pkg\n");
+		PKG_MEM_ERROR;
 		return -1;
 	}
 	anchor = anchor_lump(msg, msg->unparsed - msg->buf, 0, 0);

+ 2 - 2
src/modules/topoh/topoh_mod.c

@@ -186,7 +186,7 @@ static int mod_init(void)
 	th_via_prefix.s = (char*)pkg_malloc(th_via_prefix.len+1);
 	if(th_via_prefix.s==NULL)
 	{
-		LM_ERR("via prefix parameter is invalid\n");
+		PKG_MEM_ERROR_FMT("via prefix parameter\n");
 		goto error;
 	}
 	/* 'sip:' + ip + ';' + param + '=' + prefix (+ '\0') */
@@ -195,7 +195,7 @@ static int mod_init(void)
 	th_uri_prefix.s = (char*)pkg_malloc(th_uri_prefix.len+1);
 	if(th_uri_prefix.s==NULL)
 	{
-		LM_ERR("uri prefix parameter is invalid\n");
+		PKG_MEM_ERROR_FMT("uri prefix parameter\n");
 		goto error;
 	}
 	/* build via prefix */