Browse code

app_lua: use mem error macros

Victor Seva authored on 28/12/2018 14:50:27
Showing 3 changed files
... ...
@@ -81,14 +81,14 @@ int lua_sr_alloc_script_ver(void)
81 81
 	sr_lua_script_ver = (sr_lua_script_ver_t *) shm_malloc(sizeof(sr_lua_script_ver_t));
82 82
 	if(sr_lua_script_ver==NULL)
83 83
 	{
84
-		LM_ERR("cannot allocate shm memory\n");
84
+		SHM_MEM_ERROR;
85 85
 		return -1;
86 86
 	}
87 87
 
88 88
 	sr_lua_script_ver->version = (unsigned int *) shm_malloc(sizeof(unsigned int)*size);
89 89
 	if(sr_lua_script_ver->version==NULL)
90 90
 	{
91
-		LM_ERR("cannot allocate shm memory\n");
91
+		SHM_MEM_ERROR;
92 92
 		goto error;
93 93
 	}
94 94
 	memset(sr_lua_script_ver->version, 0, sizeof(unsigned int)*size);
... ...
@@ -136,7 +136,7 @@ int sr_lua_load_script(char *script)
136 136
 	li = (sr_lua_load_t*)pkg_malloc(sizeof(sr_lua_load_t));
137 137
 	if(li==NULL)
138 138
 	{
139
-		LM_ERR("no more pkg\n");
139
+		PKG_MEM_ERROR;
140 140
 		return -1;
141 141
 	}
142 142
 	memset(li, 0, sizeof(sr_lua_load_t));
... ...
@@ -451,7 +451,7 @@ int sr_lua_reload_script(void)
451 451
 		_app_lua_sv = (int *) pkg_malloc(sizeof(int)*sv_len);
452 452
 		if(_app_lua_sv==NULL)
453 453
 		{
454
-			LM_ERR("no more pkg memory\n");
454
+			PKG_MEM_ERROR;
455 455
 			return -1;
456 456
 		}
457 457
 	}
... ...
@@ -646,7 +646,7 @@ static int lua_sr_tm_t_on_branch_failure(lua_State *L)
646 646
 	{
647 647
 		if ((rt_name.s = pkg_reallocxf(rt_name.s, rt_name_len+1)) == NULL)
648 648
 		{
649
-			LM_ERR("No memory left in branch_failure fixup\n");
649
+			PKG_MEM_ERROR;
650 650
 			return -1;
651 651
 		}
652 652
 		rt_name.len = rt_name_len;
... ...
@@ -171,7 +171,7 @@ static int lua_sr_modf (lua_State *L)
171 171
 			argv[i] = (char*)pkg_malloc(strlen(luav[i])+1);
172 172
 			if(argv[i]==NULL)
173 173
 			{
174
-				LM_ERR("no more pkg\n");
174
+				PKG_MEM_ERROR;
175 175
 				goto error;
176 176
 			}
177 177
 			strcpy(argv[i], luav[i]);
... ...
@@ -743,7 +743,7 @@ static int lua_sr_hdr_append (lua_State *L)
743 743
 	hdr = (char*)pkg_malloc(len+1);
744 744
 	if(hdr==NULL)
745 745
 	{
746
-		LM_ERR("no pkg memory left\n");
746
+		PKG_MEM_ERROR;
747 747
 		return 0;
748 748
 	}
749 749
 	memcpy(hdr, txt, len);
... ...
@@ -829,7 +829,7 @@ static int lua_sr_hdr_insert (lua_State *L)
829 829
 	hdr = (char*)pkg_malloc(len+1);
830 830
 	if(hdr==NULL)
831 831
 	{
832
-		LM_ERR("no pkg memory left\n");
832
+		PKG_MEM_ERROR;
833 833
 		return 0;
834 834
 	}
835 835
 	memcpy(hdr, txt, len);