Browse code

switch.c: logging: convert LOG to LM_*

Ovidiu Sas authored on 04/10/2014 01:50:19
Showing 1 changed files
... ...
@@ -197,19 +197,16 @@ int fix_switch(struct action* t)
197 197
 	for (c=(struct case_stms*)t->val[1].u.data; c; c=c->next){
198 198
 		if (c->ct_rve){
199 199
 			if (c->type!=MATCH_INT){
200
-				LOG(L_ERR, "ERROR: fix_switch: wrong case type %d (int"
201
-							"expected)\n", c->type);
200
+				LM_ERR("wrong case type %d (int expected)\n", c->type);
202 201
 				return E_UNSPEC;
203 202
 			}
204 203
 			if (!rve_is_constant(c->ct_rve)){
205
-				LOG(L_ERR, "ERROR: fix_switch: non constant "
206
-						"expression in case\n");
204
+				LM_ERR("non constant expression in case\n");
207 205
 				return E_BUG;
208 206
 			}
209 207
 			if (rval_expr_eval_int(0, 0,  &c->label.match_int, c->ct_rve)
210 208
 					<0){
211
-				LOG(L_ERR, "ERROR: fix_switch: case expression"
212
-						" (%d,%d) has non-interger type\n",
209
+				LM_ERR("case expression (%d,%d) has non-interger type\n",
213 210
 						c->ct_rve->fpos.s_line,
214 211
 						c->ct_rve->fpos.s_col);
215 212
 				return E_BUG;
... ...
@@ -218,7 +215,7 @@ int fix_switch(struct action* t)
218 218
 			n++; /* count only non-default cases */
219 219
 		}else{
220 220
 			if (default_found){
221
-				LOG(L_ERR, "ERROR: fix_switch: more then one \"default\"");
221
+				LM_ERR("more then one \"default\"");
222 222
 				return E_UNSPEC;
223 223
 			}
224 224
 			default_found=1;
... ...
@@ -246,8 +243,7 @@ int fix_switch(struct action* t)
246 246
 			}
247 247
 			DBG("SWITCH: default only switch with side-effect...\n");
248 248
 		}else{
249
-			LOG(L_CRIT, "BUG: fix_switch: empty switch not expected at this"
250
-					" point\n");
249
+			LM_CRIT("empty switch not expected at this point\n");
251 250
 			ret=E_BUG;
252 251
 			goto error;
253 252
 		}
... ...
@@ -255,7 +251,7 @@ int fix_switch(struct action* t)
255 255
 	cond=pkg_malloc(sizeof(cond[0])*n);
256 256
 	jmp_bm=pkg_malloc(sizeof(jmp_bm[0])*n);
257 257
 	if (cond==0 || jmp_bm==0){
258
-		LOG(L_ERR, "ERROR: fix_switch: memory allocation failure\n");
258
+		LM_ERR("memory allocation failure\n");
259 259
 		ret=E_OUT_OF_MEM;
260 260
 		goto error;
261 261
 	}
... ...
@@ -280,7 +276,7 @@ int fix_switch(struct action* t)
280 280
 		} else {
281 281
 			for (j=0; j<n; j++){
282 282
 				if (cond[j]==c->label.match_int){
283
-					LOG(L_ERR, "ERROR: fix_switch: duplicate case (%d,%d)\n",
283
+					LM_ERR("duplicate case (%d,%d)\n",
284 284
 							c->ct_rve->fpos.s_line, c->ct_rve->fpos.s_col);
285 285
 					ret=E_UNSPEC;
286 286
 					goto error;
... ...
@@ -298,8 +294,7 @@ int fix_switch(struct action* t)
298 298
 	if ( (scr_opt_lev>=2) &&
299 299
 			!rve_has_side_effects(sw_rve) && rve_is_constant(sw_rve)){
300 300
 		if (rval_expr_eval_int(0, 0,  &val, sw_rve) <0){
301
-			LOG(L_ERR, "ERROR: fix_switch: wrong type for switch(...) "
302
-					"expression (%d,%d)\n", 
301
+			LM_ERR("wrong type for switch(...) expression (%d,%d)\n", 
303 302
 					sw_rve->fpos.s_line, sw_rve->fpos.s_col);
304 303
 			ret=E_UNSPEC;
305 304
 			goto error;
... ...
@@ -355,7 +350,7 @@ int fix_switch(struct action* t)
355 355
 		 with a n-best_hits normal switch table */
356 356
 		jmp=mk_switch_jmp_table(end-start+1, n-best_hits);
357 357
 		if (jmp==0){
358
-			LOG(L_ERR, "ERROR: fix_switch: memory allocation error\n");
358
+			LM_ERR("memory allocation error\n");
359 359
 			ret=E_OUT_OF_MEM;
360 360
 			goto error;
361 361
 		}
... ...
@@ -385,7 +380,7 @@ int fix_switch(struct action* t)
385 385
 	}else{
386 386
 		sct=mk_switch_cond_table(n);
387 387
 		if (sct==0){
388
-			LOG(L_ERR, "ERROR: fix_switch: memory allocation error\n");
388
+			LM_ERR("memory allocation error\n");
389 389
 			ret=E_OUT_OF_MEM;
390 390
 			goto error;
391 391
 		}
... ...
@@ -468,26 +463,24 @@ static int fix_match(struct action* t)
468 468
 	for (c=(struct case_stms*)t->val[1].u.data; c; c=c->next){
469 469
 		if (c->ct_rve){
470 470
 			if (c->type!=MATCH_STR && c->type!=MATCH_RE){
471
-				LOG(L_ERR, "ERROR: fix_match: wrong case type %d (string"
471
+				LM_ERR("wrong case type %d (string"
472 472
 							"or RE expected)\n", c->type);
473 473
 				return E_UNSPEC;
474 474
 			}
475 475
 			if (!rve_is_constant(c->ct_rve)){
476
-				LOG(L_ERR, "ERROR: fix_match: non constant "
477
-						"expression in case\n");
476
+				LM_ERR("non constant expression in case\n");
478 477
 				ret=E_BUG;
479 478
 				goto error;
480 479
 			}
481 480
 			if ((rv=rval_expr_eval(0, 0, c->ct_rve)) == 0 ){
482
-				LOG(L_ERR, "ERROR: fix_match: bad case expression"
483
-						" (%d,%d)\n",
481
+				LM_ERR("bad case expression (%d,%d)\n",
484 482
 						c->ct_rve->fpos.s_line,
485 483
 						c->ct_rve->fpos.s_col);
486 484
 				ret=E_BUG;
487 485
 				goto error;
488 486
 			}
489 487
 			if (rval_get_str(0, 0, &s, rv, 0)<0){
490
-				LOG(L_ERR, "ERROR: fix_match (%d,%d): out of memory?\n",
488
+				LM_ERR("(%d,%d): out of memory?\n",
491 489
 						c->ct_rve->fpos.s_line,
492 490
 						c->ct_rve->fpos.s_col);
493 491
 				ret=E_BUG;
... ...
@@ -495,7 +488,7 @@ static int fix_match(struct action* t)
495 495
 			}
496 496
 			if (c->type==MATCH_RE){
497 497
 				if ((regex=pkg_malloc(sizeof(regex_t))) == 0){
498
-					LOG(L_ERR, "ERROR: fix_match: out of memory\n");
498
+					LM_ERR("out of memory\n");
499 499
 					ret=E_OUT_OF_MEM;
500 500
 					goto error;
501 501
 				}
... ...
@@ -503,8 +496,7 @@ static int fix_match(struct action* t)
503 503
 							REG_EXTENDED | REG_NOSUB | c->re_flags) !=0){
504 504
 					pkg_free(regex);
505 505
 					regex=0;
506
-					LOG(L_ERR, "ERROR: fix_match (%d, %d): bad regular"
507
-								" expression %.*s\n",
506
+					LM_ERR("(%d, %d): bad regular expression %.*s\n",
508 507
 							c->ct_rve->fpos.s_line,
509 508
 							c->ct_rve->fpos.s_col,
510 509
 							s.len, ZSW(s.s));
... ...
@@ -518,7 +510,7 @@ static int fix_match(struct action* t)
518 518
 				s.s=0;
519 519
 				s.len=0;
520 520
 			}else{
521
-				LOG(L_CRIT, "BUG: fix_match (%d,%d): wrong case type %d\n",
521
+				LM_CRIT("(%d,%d): wrong case type %d\n",
522 522
 						c->ct_rve->fpos.s_line, c->ct_rve->fpos.s_col,
523 523
 						c->type);
524 524
 				ret=E_BUG;
... ...
@@ -536,8 +528,7 @@ static int fix_match(struct action* t)
536 536
 			}
537 537
 		}else{
538 538
 			if (default_found){
539
-				LOG(L_ERR, "ERROR: fix_match: more then one \"default\""
540
-						" label found (%d, %d)\n",
539
+				LM_ERR("more then one \"default\" label found (%d, %d)\n",
541 540
 						(c->ct_rve)?c->ct_rve->fpos.s_line:0,
542 541
 						(c->ct_rve)?c->ct_rve->fpos.s_col:0);
543 542
 				ret=E_UNSPEC;
... ...
@@ -567,8 +558,7 @@ static int fix_match(struct action* t)
567 567
 			}
568 568
 			DBG("MATCH: default only switch with side-effect...\n");
569 569
 		}else{
570
-			LOG(L_CRIT, "BUG: fix_match: empty switch not expected at this"
571
-					" point\n");
570
+			LM_CRIT("empty switch not expected at this point\n");
572 571
 			ret=E_BUG;
573 572
 			goto error;
574 573
 		}
... ...
@@ -577,7 +567,7 @@ static int fix_match(struct action* t)
577 577
 	match=pkg_malloc(sizeof(match[0])*n);
578 578
 	jmp_bm=pkg_malloc(sizeof(jmp_bm[0])*n);
579 579
 	if (match==0 || jmp_bm==0){
580
-		LOG(L_ERR, "ERROR: fix_match: memory allocation failure\n");
580
+		LM_ERR("memory allocation failure\n");
581 581
 		ret=E_OUT_OF_MEM;
582 582
 		goto error;
583 583
 	}
... ...
@@ -607,8 +597,8 @@ static int fix_match(struct action* t)
607 607
 						 match[j].l.s.len ==  c->label.match_str.len &&
608 608
 						 memcmp(match[j].l.s.s, c->label.match_str.s,
609 609
 							 		match[j].l.s.len) == 0 ){
610
-						LOG(L_ERR, "ERROR: fix_match: duplicate case"
611
-								" (%d,%d)\n", c->ct_rve->fpos.s_line,
610
+						LM_ERR("duplicate case (%d,%d)\n",
611
+								c->ct_rve->fpos.s_line,
612 612
 								c->ct_rve->fpos.s_col);
613 613
 						ret=E_UNSPEC;
614 614
 						goto error;
... ...
@@ -634,13 +624,13 @@ static int fix_match(struct action* t)
634 634
 	if ( (scr_opt_lev>=2) &&
635 635
 			!rve_has_side_effects(m_rve) && rve_is_constant(m_rve)){
636 636
 		if ((rv=rval_expr_eval(0, 0, m_rve)) == 0){
637
-			LOG(L_ERR, "ERROR: fix_match: bad expression (%d,%d)\n", 
637
+			LM_ERR("bad expression (%d,%d)\n", 
638 638
 					m_rve->fpos.s_line, m_rve->fpos.s_col);
639 639
 			ret=E_UNSPEC;
640 640
 			goto error;
641 641
 		}
642 642
 		if (rval_get_str(0, 0, &s, rv, 0) < 0 ){
643
-				LOG(L_ERR, "ERROR: fix_match (%d,%d): bad string expression\n",
643
+				LM_ERR("(%d,%d): bad string expression\n",
644 644
 						m_rve->fpos.s_line,
645 645
 						m_rve->fpos.s_col);
646 646
 			ret=E_UNSPEC;
... ...
@@ -678,7 +668,7 @@ static int fix_match(struct action* t)
678 678
 	}
679 679
 	mct=mk_match_cond_table(n);
680 680
 	if (mct==0){
681
-		LOG(L_ERR, "ERROR: fix_match: memory allocation error\n");
681
+		LM_ERR("memory allocation error\n");
682 682
 		ret=E_OUT_OF_MEM;
683 683
 		goto error;
684 684
 	}