Browse code

data_lump.c: logging: convert LOG to LM_*

Ovidiu Sas authored on 03/10/2014 21:49:29
Showing 1 changed files
... ...
@@ -68,7 +68,7 @@ struct lump* append_new_lump(struct lump** list, char* new_hdr,
68 68
 
69 69
 	tmp=pkg_malloc(sizeof(struct lump));
70 70
 	if (tmp==0){
71
-		LOG(L_ERR, "ERROR: append_new_lump: out of memory\n");
71
+		LM_ERR("out of memory\n");
72 72
 		return 0;
73 73
 	}
74 74
 		
... ...
@@ -94,7 +94,7 @@ struct lump* add_new_lump(struct lump** list, char* new_hdr,
94 94
 
95 95
 	tmp=pkg_malloc(sizeof(struct lump));
96 96
 	if (tmp==0){
97
-		LOG(L_ERR, "ERROR: add_new_lump: out of memory\n");
97
+		LM_ERR("out of memory\n");
98 98
 		return 0;
99 99
 	}
100 100
 		
... ...
@@ -119,7 +119,7 @@ struct lump* insert_new_lump(struct lump** list, char* new_hdr,
119 119
 
120 120
 	tmp=pkg_malloc(sizeof(struct lump));
121 121
 	if (tmp==0){
122
-		LOG(L_ERR, "ERROR: insert_new_lump: out of memory\n");
122
+		LM_ERR("out of memory\n");
123 123
 		return 0;
124 124
 	}
125 125
 	memset(tmp,0,sizeof(struct lump));
... ...
@@ -144,7 +144,7 @@ struct lump* insert_new_lump_after( struct lump* after, char* new_hdr,
144 144
 	tmp=pkg_malloc(sizeof(struct lump));
145 145
 	if (tmp==0){
146 146
 		ser_error=E_OUT_OF_MEM;
147
-		LOG(L_ERR, "ERROR: insert_new_lump_after: out of memory\n");
147
+		LM_ERR("out of memory\n");
148 148
 		return 0;
149 149
 	}
150 150
 	memset(tmp,0,sizeof(struct lump));
... ...
@@ -169,7 +169,7 @@ struct lump* insert_new_lump_before( struct lump* before, char* new_hdr,
169 169
 	tmp=pkg_malloc(sizeof(struct lump));
170 170
 	if (tmp==0){
171 171
 		ser_error=E_OUT_OF_MEM;
172
-		LOG(L_ERR,"ERROR: insert_new_lump_before: out of memory\n");
172
+		LM_ERR("out of memory\n");
173 173
 		return 0;
174 174
 	}
175 175
 	memset(tmp,0,sizeof(struct lump));
... ...
@@ -194,7 +194,7 @@ struct lump* insert_subst_lump_after( struct lump* after, enum lump_subst subst,
194 194
 	tmp=pkg_malloc(sizeof(struct lump));
195 195
 	if (tmp==0){
196 196
 		ser_error=E_OUT_OF_MEM;
197
-		LOG(L_ERR, "ERROR: insert_new_lump_after: out of memory\n");
197
+		LM_ERR("out of memory\n");
198 198
 		return 0;
199 199
 	}
200 200
 	memset(tmp,0,sizeof(struct lump));
... ...
@@ -220,7 +220,7 @@ struct lump* insert_subst_lump_before(	struct lump* before,
220 220
 	tmp=pkg_malloc(sizeof(struct lump));
221 221
 	if (tmp==0){
222 222
 		ser_error=E_OUT_OF_MEM;
223
-		LOG(L_ERR,"ERROR: insert_new_lump_before: out of memory\n");
223
+		LM_ERR("out of memory\n");
224 224
 		return 0;
225 225
 	}
226 226
 	memset(tmp,0,sizeof(struct lump));
... ...
@@ -245,7 +245,7 @@ struct lump* insert_cond_lump_after( struct lump* after, enum lump_conditions c,
245 245
 	tmp=pkg_malloc(sizeof(struct lump));
246 246
 	if (tmp==0){
247 247
 		ser_error=E_OUT_OF_MEM;
248
-		LOG(L_ERR, "ERROR: insert_new_lump_after: out of memory\n");
248
+		LM_ERR("out of memory\n");
249 249
 		return 0;
250 250
 	}
251 251
 	memset(tmp,0,sizeof(struct lump));
... ...
@@ -271,7 +271,7 @@ struct lump* insert_cond_lump_before(	struct lump* before,
271 271
 	tmp=pkg_malloc(sizeof(struct lump));
272 272
 	if (tmp==0){
273 273
 		ser_error=E_OUT_OF_MEM;
274
-		LOG(L_ERR,"ERROR: insert_new_lump_before: out of memory\n");
274
+		LM_ERR("out of memory\n");
275 275
 		return 0;
276 276
 	}
277 277
 	memset(tmp,0,sizeof(struct lump));
... ...
@@ -299,23 +299,22 @@ struct lump* del_lump(struct sip_msg* msg, int offset, int len, enum _hdr_types_
299 299
 
300 300
 	/* extra checks */
301 301
 	if (offset>msg->len){
302
-		LOG(L_CRIT, "BUG: del_lump: offset exceeds message size (%d > %d)"
303
-					" aborting...\n", offset, msg->len);
302
+		LM_CRIT("offset exceeds message size (%d > %d) aborting...\n",
303
+					offset, msg->len);
304 304
 		abort();
305 305
 	}
306 306
 	if (offset+len>msg->len){
307
-		LOG(L_CRIT, " BUG: del_lump: offset + len exceeds message"
308
-				" size (%d + %d > %d)\n", offset, len,  msg->len);
307
+		LM_CRIT("offset + len exceeds message size (%d + %d > %d)\n",
308
+					offset, len,  msg->len);
309 309
 		abort();
310 310
 	}
311 311
 	if (len==0){
312
-		LOG(L_WARN, "WARNING: del_lump: called with 0 len (offset =%d)\n",
313
-				offset);
312
+		LM_WARN("0 len (offset=%d)\n", offset);
314 313
 	}
315 314
 	
316 315
 	tmp=pkg_malloc(sizeof(struct lump));
317 316
 	if (tmp==0){
318
-		LOG(L_ERR, "ERROR: del_lump: out of memory\n");
317
+		LM_ERR("out of memory\n");
319 318
 		return 0;
320 319
 	}
321 320
 	memset(tmp,0,sizeof(struct lump));
... ...
@@ -356,21 +355,21 @@ struct lump* anchor_lump(struct sip_msg* msg, int offset, int len, enum _hdr_typ
356 355
 	
357 356
 	/* extra checks */
358 357
 	if (offset>msg->len){
359
-		LOG(L_CRIT, "BUG: anchor_lump: offset exceeds message size (%d > %d)"
360
-					" aborting...\n", offset, msg->len);
358
+		LM_CRIT("offset exceeds message size (%d > %d) aborting...\n",
359
+					offset, msg->len);
361 360
 		abort();
362 361
 	}
363 362
 	if (len){
364
-		LOG(L_WARN, "WARNING: anchor_lump: called with len !=0 (%d)\n", len);
363
+		LM_WARN("len !=0 (%d)\n", len);
365 364
 		if (offset+len>msg->len)
366
-			LOG(L_WARN, "WARNING: anchor_lump: offset + len exceeds message"
367
-					" size (%d + %d > %d)\n", offset, len,  msg->len);
365
+			LM_WARN("offset + len exceeds message size (%d + %d > %d)\n",
366
+					offset, len,  msg->len);
368 367
 	}
369 368
 	
370 369
 	tmp=pkg_malloc(sizeof(struct lump));
371 370
 	if (tmp==0){
372 371
 		ser_error=E_OUT_OF_MEM;
373
-		LOG(L_ERR, "ERROR: anchor_lump: out of memory\n");
372
+		LM_ERR("out of memory\n");
374 373
 		return 0;
375 374
 	}
376 375
 	memset(tmp,0,sizeof(struct lump));
... ...
@@ -416,15 +415,15 @@ struct lump* anchor_lump2(struct sip_msg* msg, int offset, int len, enum _hdr_ty
416 415
 	
417 416
 	/* extra checks */
418 417
 	if (offset>msg->len){
419
-		LOG(L_CRIT, "BUG: anchor_lump2: offset exceeds message size (%d > %d)"
420
-					" aborting...\n", offset, msg->len);
418
+		LM_CRIT("offset exceeds message size (%d > %d) aborting...\n",
419
+					offset, msg->len);
421 420
 		abort();
422 421
 	}
423 422
 	if (len){
424
-		LOG(L_WARN, "WARNING: anchor_lump2: called with len !=0 (%d)\n", len);
423
+		LM_WARN("len !=0 (%d)\n", len);
425 424
 		if (offset+len>msg->len)
426
-			LOG(L_WARN, "WARNING: anchor_lump2: offset + len exceeds message"
427
-					" size (%d + %d > %d)\n", offset, len,  msg->len);
425
+			LM_WARN("offset + len exceeds message size (%d + %d > %d)\n",
426
+					offset, len,  msg->len);
428 427
 	}
429 428
 	
430 429
 	prev=0;
... ...
@@ -448,7 +447,7 @@ struct lump* anchor_lump2(struct sip_msg* msg, int offset, int len, enum _hdr_ty
448 447
 	tmp=pkg_malloc(sizeof(struct lump));
449 448
 	if (tmp==0){
450 449
 		ser_error=E_OUT_OF_MEM;
451
-		LOG(L_ERR, "ERROR: anchor_lump2: out of memory\n");
450
+		LM_ERR("out of memory\n");
452 451
 		return 0;
453 452
 	}
454 453
 	memset(tmp,0,sizeof(struct lump));
... ...
@@ -472,8 +471,7 @@ void free_lump(struct lump* lmp)
472 471
 	if (lmp && (lmp->op==LUMP_ADD)){
473 472
 		if (lmp->u.value){
474 473
 			if (lmp->flags &(LUMPFLAG_DUPED|LUMPFLAG_SHMEM)){
475
-				LOG(L_CRIT, "BUG: free_lump: called on a not free-able lump:"
476
-						"%p flags=%x\n", lmp, lmp->flags);
474
+				LM_CRIT("non free-able lump: %p flags=%x\n", lmp, lmp->flags);
477 475
 				abort();
478 476
 			}else{
479 477
 				pkg_free(lmp->u.value);
... ...
@@ -574,8 +572,7 @@ static struct lump *dup_lump_list_r( struct lump *l,
574 572
 								LD_AFTER, &deep_error);
575 573
 				break;
576 574
 		default:
577
-				LOG(L_CRIT, "BUG: dup_limp_list_r: unknown dir: "
578
-						"%d\n", dir );
575
+				LM_CRIT("unknown dir: %d\n", dir );
579 576
 				deep_error=1;
580 577
 	}
581 578
 	if (deep_error) goto deeperror;
... ...
@@ -584,7 +581,7 @@ static struct lump *dup_lump_list_r( struct lump *l,
584 581
 	return new_lump;
585 582
 
586 583
 deeperror:
587
-	LOG(L_ERR, "ERROR: dup_lump_list_r: out of mem\n");
584
+	LM_ERR("out of mem\n");
588 585
 	free_shallow_lump(new_lump);
589 586
 	*error=1;
590 587
 	return 0;