[sr-dev] git:master: parser: const-correctness for some module utility functions

Henning Westerholt hw at kamailio.org
Thu Jul 5 23:16:10 CEST 2012


Module: sip-router
Branch: master
Commit: 6742b34bb385742aa80cd23d9dedbd366a243650
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6742b34bb385742aa80cd23d9dedbd366a243650

Author: Henning Westerholt <hw at kamailio.org>
Committer: Henning Westerholt <hw at kamailio.org>
Date:   Thu Jul  5 23:14:42 2012 +0200

parser: const-correctness for some module utility functions

---

 parser/msg_parser.c |   12 ++++++------
 parser/msg_parser.h |   11 ++++++-----
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/parser/msg_parser.c b/parser/msg_parser.c
index 986c8e0..cb0215b 100644
--- a/parser/msg_parser.c
+++ b/parser/msg_parser.c
@@ -808,7 +808,7 @@ int set_path_vector(struct sip_msg* msg, str* path)
 }
 
 
-void reset_path_vector(struct sip_msg* msg)
+void reset_path_vector(struct sip_msg* const msg)
 {
 	if(msg->path_vec.s != 0) {
 		pkg_free(msg->path_vec.s);
@@ -818,7 +818,7 @@ void reset_path_vector(struct sip_msg* msg)
 }
 
 
-hdr_field_t* get_hdr(sip_msg_t *msg, enum _hdr_types_t ht)
+hdr_field_t* get_hdr(const sip_msg_t* const msg, const enum _hdr_types_t ht)
 {
 	hdr_field_t *hdr;
 
@@ -830,7 +830,7 @@ hdr_field_t* get_hdr(sip_msg_t *msg, enum _hdr_types_t ht)
 }
 
 
-hdr_field_t* next_sibling_hdr(hdr_field_t *hf)
+hdr_field_t* next_sibling_hdr(const hdr_field_t* const hf)
 {
 	hdr_field_t *hdr;
 
@@ -840,7 +840,7 @@ hdr_field_t* next_sibling_hdr(hdr_field_t *hf)
 	return NULL;
 }
 
-hdr_field_t* get_hdr_by_name(sip_msg_t *msg, char *name, int name_len)
+hdr_field_t* get_hdr_by_name(const sip_msg_t* const msg, const char* const name, const int name_len)
 {
 	hdr_field_t *hdr;
 
@@ -852,8 +852,8 @@ hdr_field_t* get_hdr_by_name(sip_msg_t *msg, char *name, int name_len)
 	return NULL;
 }
 
-
-hdr_field_t* next_sibling_hdr_by_name(hdr_field_t *hf)
+/** not used yet */
+hdr_field_t* next_sibling_hdr_by_name(const hdr_field_t* const hf)
 {
 	hdr_field_t *hdr;
 
diff --git a/parser/msg_parser.h b/parser/msg_parser.h
index bc9a551..c517846 100644
--- a/parser/msg_parser.h
+++ b/parser/msg_parser.h
@@ -439,14 +439,15 @@ int set_dst_uri(struct sip_msg* const msg, const str* const uri);
 /*! \brief If the dst_uri is set to an URI then reset it */
 void reset_dst_uri(struct sip_msg* const msg);
 
-hdr_field_t* get_hdr(sip_msg_t *msg, enum _hdr_types_t ht);
-hdr_field_t* next_sibling_hdr(hdr_field_t *hf);
-hdr_field_t* get_hdr_by_name(sip_msg_t *msg, char *name, int name_len);
-hdr_field_t* next_sibling_hdr_by_name(hdr_field_t *hf);
+hdr_field_t* get_hdr(const sip_msg_t* const msg, const enum _hdr_types_t ht);
+hdr_field_t* next_sibling_hdr(const hdr_field_t* const hf);
+/** not used yet */
+hdr_field_t* get_hdr_by_name(const sip_msg_t* const msg, const char* const name, const int name_len);
+hdr_field_t* next_sibling_hdr_by_name(const hdr_field_t* const hf);
 
 int set_path_vector(struct sip_msg* msg, str* path);
 
-void reset_path_vector(struct sip_msg* msg);
+void reset_path_vector(struct sip_msg* const msg);
 
 
 /** force a specific send socket for forwarding a request.




More information about the sr-dev mailing list