Browse code

pkg_malloc -> shm_malloc

Jan Janak authored on 04/04/2003 14:21:08
Showing 1 changed files
... ...
@@ -32,7 +32,7 @@
32 32
 
33 33
 #include <stdio.h>
34 34
 #include <string.h>
35
-#include "../../mem/mem.h"
35
+#include "../../mem/shm_mem.h"
36 36
 #include "../../dprint.h"
37 37
 #include "../../parser/contact/parse_contact.h"
38 38
 #include "../../parser/parse_to.h"
... ...
@@ -47,11 +47,11 @@
47 47
 
48 48
 
49 49
 /*
50
- * Make a copy of a str structure using pkg_malloc
50
+ * Make a copy of a str structure using shm_malloc
51 51
  */
52 52
 static inline int str_duplicate(str* _d, str* _s)
53 53
 {
54
-	_d->s = pkg_malloc(_s->len);
54
+	_d->s = shm_malloc(_s->len);
55 55
 	if (!_d->s) {
56 56
 		LOG(L_ERR, "str_duplicate(): No memory left\n");
57 57
 		return -1;
... ...
@@ -75,7 +75,7 @@ int new_dlg_uac(str* _cid, str* _ltag, unsigned int _lseq, str* _luri, str* _rur
75 75
 		return -1;
76 76
 	}
77 77
 
78
-	res = (dlg_t*)pkg_malloc(sizeof(dlg_t));
78
+	res = (dlg_t*)shm_malloc(sizeof(dlg_t));
79 79
 	if (res == 0) {
80 80
 		LOG(L_ERR, "new_dlg_uac(): No memory left\n");
81 81
 		return -2;
... ...
@@ -266,12 +266,12 @@ static inline int response2dlg(struct sip_msg* _m, dlg_t* _d)
266 266
 
267 267
 	return 0;
268 268
  err2:
269
-	if (_d->id.rem_tag.s) pkg_free(_d->id.rem_tag.s);
269
+	if (_d->id.rem_tag.s) shm_free(_d->id.rem_tag.s);
270 270
 	_d->id.rem_tag.s = 0;
271 271
 	_d->id.rem_tag.len = 0;
272 272
 
273 273
  err1:
274
-	if (_d->rem_target.s) pkg_free(_d->rem_target.s);
274
+	if (_d->rem_target.s) shm_free(_d->rem_target.s);
275 275
 	_d->rem_target.s = 0;
276 276
 	_d->rem_target.len = 0;
277 277
 	return -4;
... ...
@@ -419,7 +419,7 @@ static inline int dlg_confirmed_resp_uac(dlg_t* _d, struct sip_msg* _m)
419 419
 		     /* If there is a contact URI */
420 420
 		if (contact.len) {
421 421
 			     /* Free old remote target if any */
422
-			if (_d->rem_target.s) pkg_free(_d->rem_target.s);
422
+			if (_d->rem_target.s) shm_free(_d->rem_target.s);
423 423
 			     /* Duplicate new remote target */
424 424
 			if (str_duplicate(&_d->rem_target, &contact) < 0) return -4;
425 425
 		}
... ...
@@ -522,7 +522,7 @@ static inline int get_dlg_uri(struct hdr_field* _h, str* _s)
522 522
 		}
523 523
 	}
524 524
 
525
-	_s->s = pkg_malloc(body->body.len - tag_len);
525
+	_s->s = shm_malloc(body->body.len - tag_len);
526 526
 	if (!_s->s) {
527 527
 		LOG(L_ERR, "get_dlg_uri(): No memory left\n");
528 528
 		return -1;
... ...
@@ -574,23 +574,23 @@ static inline int request2dlg(struct sip_msg* _m, dlg_t* _d)
574 574
 
575 575
 	return 0;
576 576
  err5:
577
-	if (_d->loc_uri.s) pkg_free(_d->loc_uri.s);
577
+	if (_d->loc_uri.s) shm_free(_d->loc_uri.s);
578 578
 	_d->loc_uri.s = 0;
579 579
 	_d->loc_uri.len = 0;
580 580
  err4:
581
-	if (_d->rem_uri.s) pkg_free(_d->rem_uri.s);
581
+	if (_d->rem_uri.s) shm_free(_d->rem_uri.s);
582 582
 	_d->rem_uri.s = 0;
583 583
 	_d->rem_uri.len = 0;
584 584
  err3:
585
-	if (_d->id.call_id.s) pkg_free(_d->id.call_id.s);
585
+	if (_d->id.call_id.s) shm_free(_d->id.call_id.s);
586 586
 	_d->id.call_id.s = 0;
587 587
 	_d->id.call_id.len = 0;
588 588
  err2:
589
-	if (_d->id.rem_tag.s) pkg_free(_d->id.rem_tag.s);
589
+	if (_d->id.rem_tag.s) shm_free(_d->id.rem_tag.s);
590 590
 	_d->id.rem_tag.s = 0;
591 591
 	_d->id.rem_tag.len = 0;
592 592
  err1:
593
-	if (_d->rem_target.s) pkg_free(_d->rem_target.s);
593
+	if (_d->rem_target.s) shm_free(_d->rem_target.s);
594 594
 	_d->rem_target.s = 0;
595 595
 	_d->rem_target.len = 0;
596 596
 	return -4;
... ...
@@ -614,7 +614,7 @@ int new_dlg_uas(struct sip_msg* _req, int _code, str* _tag, dlg_t** _d)
614 614
 		return -2;
615 615
 	}
616 616
 
617
-	res = (dlg_t*)pkg_malloc(sizeof(dlg_t));
617
+	res = (dlg_t*)shm_malloc(sizeof(dlg_t));
618 618
 	if (res == 0) {
619 619
 		LOG(L_ERR, "new_dlg_uac(): No memory left\n");
620 620
 		return -3;
... ...
@@ -678,7 +678,7 @@ int dlg_request_uas(dlg_t* _d, struct sip_msg* _m)
678 678
 		
679 679
 		if (get_contact_uri(_m, &contact) < 0) return -5;
680 680
 		if (contact.len) {
681
-			if (_d->rem_target.s) pkg_free(_d->rem_target.s);
681
+			if (_d->rem_target.s) shm_free(_d->rem_target.s);
682 682
 			if (str_duplicate(&_d->rem_target, &contact) < 0) return -6;
683 683
 		}
684 684
 	}
... ...
@@ -694,17 +694,17 @@ void free_dlg(dlg_t* _d)
694 694
 {
695 695
         if (!_d) return;
696 696
 
697
-	if (_d->id.call_id.s) pkg_free(_d->id.call_id.s);
698
-	if (_d->id.rem_tag.s) pkg_free(_d->id.rem_tag.s);
699
-	if (_d->id.loc_tag.s) pkg_free(_d->id.loc_tag.s);
697
+	if (_d->id.call_id.s) shm_free(_d->id.call_id.s);
698
+	if (_d->id.rem_tag.s) shm_free(_d->id.rem_tag.s);
699
+	if (_d->id.loc_tag.s) shm_free(_d->id.loc_tag.s);
700 700
 
701
-	if (_d->loc_uri.s) pkg_free(_d->loc_uri.s);
702
-	if (_d->rem_uri.s) pkg_free(_d->rem_uri.s);
703
-	if (_d->rem_target.s) pkg_free(_d->rem_target.s);
701
+	if (_d->loc_uri.s) shm_free(_d->loc_uri.s);
702
+	if (_d->rem_uri.s) shm_free(_d->rem_uri.s);
703
+	if (_d->rem_target.s) shm_free(_d->rem_target.s);
704 704
 
705 705
 	     /* Free all routes in the route set */
706 706
 	free_rr(&_d->route_set);
707
-	pkg_free(_d);
707
+	shm_free(_d);
708 708
 }
709 709
 
710 710