Browse code

pua_dialoginfo: convert to PKG/SHM memory logging helper functions

Victor Seva authored on 29/07/2020 08:32:05
Showing 2 changed files
... ...
@@ -240,7 +240,7 @@ str* build_dialoginfo(char *state, str *entity, str *peer, str *callid,
240 240
 	body = (str*)pkg_malloc(sizeof(str));
241 241
 	if(body == NULL)
242 242
 	{
243
-		LM_ERR("while allocating memory\n");
243
+		PKG_MEM_ERROR;
244 244
 		goto error;
245 245
 	}
246 246
 	memset(body, 0, sizeof(str));
... ...
@@ -327,7 +327,7 @@ void dialog_publish(char *state, str* ruri, str *entity, str *peer, str *callid,
327 327
 	publ= (publ_info_t*)pkg_malloc(size);
328 328
 	if(publ== NULL)
329 329
 	{
330
-		LM_ERR("no more share memory\n");
330
+		PKG_MEM_ERROR;
331 331
 		goto error;
332 332
 	}
333 333
 	memset(publ, 0, size);
... ...
@@ -448,7 +448,7 @@ struct str_list* get_str_list(unsigned short avp_flags, int_str avp_name) {
448 448
 		}
449 449
 
450 450
 		if (list_current==0) {
451
-			LM_ERR("no more shm mem (%d)\n",len);
451
+			SHM_MEM_ERROR;
452 452
 			return 0;
453 453
 		}
454 454
 
... ...
@@ -483,7 +483,7 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type)
483 483
 
484 484
 	dlginfo = (struct dlginfo_cell*)shm_malloc( len );
485 485
 	if (dlginfo==0) {
486
-		LM_ERR("no more shm mem (%d)\n",len);
486
+		SHM_MEM_ERROR;
487 487
 		return NULL;
488 488
 	}
489 489
 	memset( dlginfo, 0, len);
... ...
@@ -531,7 +531,7 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type)
531 531
 				dlginfo->pubruris_caller =
532 532
 					(struct str_list*)shm_malloc( sizeof(struct str_list) );
533 533
 				if (dlginfo->pubruris_caller==0) {
534
-					LM_ERR("no more shm mem (%d)\n", (int) sizeof(struct str_list));
534
+					SHM_MEM_ERROR;
535 535
 					free_dlginfo_cell(dlginfo);
536 536
 					return NULL;
537 537
 				}
... ...
@@ -546,7 +546,7 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type)
546 546
 				dlginfo->pubruris_callee =
547 547
 					(struct str_list*)shm_malloc( sizeof(struct str_list) );
548 548
 				if (dlginfo->pubruris_callee==0) {
549
-					LM_ERR("no more shm mem (%d)\n", (int) sizeof(struct str_list));
549
+					SHM_MEM_ERROR;
550 550
 					free_dlginfo_cell(dlginfo);
551 551
 					return NULL;
552 552
 				}
... ...
@@ -567,7 +567,7 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type)
567 567
 		dlginfo->pubruris_caller =
568 568
 			(struct str_list*)shm_malloc( sizeof(struct str_list) );
569 569
 		if (dlginfo->pubruris_caller==0) {
570
-			LM_ERR("no more shm mem (%d)\n", (int) sizeof(struct str_list));
570
+			SHM_MEM_ERROR;
571 571
 			free_dlginfo_cell(dlginfo);
572 572
 			return NULL;
573 573
 		}
... ...
@@ -577,7 +577,7 @@ struct dlginfo_cell* get_dialog_data(struct dlg_cell *dlg, int type)
577 577
 		dlginfo->pubruris_callee =
578 578
 			(struct str_list*)shm_malloc( sizeof(struct str_list) );
579 579
 		if (dlginfo->pubruris_callee==0) {
580
-			LM_ERR("no more shm mem (%d)\n", (int) sizeof(struct str_list));
580
+			SHM_MEM_ERROR;
581 581
 			free_dlginfo_cell(dlginfo);
582 582
 			return NULL;
583 583
 		}