Bläddra i källkod

parser: const-correctness for some module utility functions

Henning Westerholt 13 år sedan
förälder
incheckning
6742b34bb3
2 ändrade filer med 12 tillägg och 11 borttagningar
  1. 6 6
      parser/msg_parser.c
  2. 6 5
      parser/msg_parser.h

+ 6 - 6
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;
 

+ 6 - 5
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.