[sr-dev] git:master: core: added function to remove an exiting lump structure from internal list
Daniel-Constantin Mierla
miconda at gmail.com
Fri Jan 4 20:47:43 CET 2013
Module: sip-router
Branch: master
Commit: 7fd561975706676e61bb3d90968652edcb96f35c
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7fd561975706676e61bb3d90968652edcb96f35c
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: Fri Jan 4 19:25:05 2013 +0100
core: added function to remove an exiting lump structure from internal list
---
data_lump.c | 29 +++++++++++++++++++++++++++++
data_lump.h | 2 ++
2 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/data_lump.c b/data_lump.c
index 5016383..dae9857 100644
--- a/data_lump.c
+++ b/data_lump.c
@@ -712,3 +712,32 @@ unsigned int count_applied_lumps(struct lump *ll, int type)
return n;
}
+int remove_lump(sip_msg_t *msg, struct lump *l)
+{
+ struct lump *t = NULL;
+ struct lump *prev = NULL;
+ struct lump **list = NULL;
+
+ list=&msg->add_rm;
+ for (t=*list; t; prev=t, t=t->next) {
+ if(t==l)
+ break;
+ }
+ if(t==NULL) {
+ list=&msg->body_lumps;
+ for (t=*list; t; prev=t, t=t->next) {
+ if(t==l)
+ break;
+ }
+ }
+ if(t!=NULL) {
+ if(prev==NULL) {
+ *list = t->next;
+ } else {
+ prev->next = t->next;
+ }
+ free_lump(t);
+ return 1;
+ }
+ return 0;
+}
diff --git a/data_lump.h b/data_lump.h
index 5438c97..88a1f0d 100644
--- a/data_lump.h
+++ b/data_lump.h
@@ -95,4 +95,6 @@ void free_duped_lump_list(struct lump* l);
/*! \brief remove all non-SHMEM lumps from the list */
void del_nonshm_lump( struct lump** lump_list );
+/*! \brief remove the lump from the internal lists */
+int remove_lump(sip_msg_t *msg, struct lump *l);
#endif
More information about the sr-dev
mailing list