Browse Source

Declare some char * arguments as const where appropriate.

Maxim Sobolev 21 years ago
parent
commit
d1b976d9c2
2 changed files with 9 additions and 9 deletions
  1. 7 7
      re.c
  2. 2 2
      re.h

+ 7 - 7
re.c

@@ -268,7 +268,7 @@ error:
 
 
 
 
 
 
-static int replace_len(char* match, int nmatch, regmatch_t* pmatch,
+static int replace_len(const char* match, int nmatch, regmatch_t* pmatch,
 					struct subst_expr* se, struct sip_msg* msg)
 					struct subst_expr* se, struct sip_msg* msg)
 {
 {
 	int r;
 	int r;
@@ -314,7 +314,7 @@ static int replace_len(char* match, int nmatch, regmatch_t* pmatch,
 
 
 /* rpl.s will be alloc'ed with the proper size & rpl.len set
 /* rpl.s will be alloc'ed with the proper size & rpl.len set
  * returns 0 on success, <0 on error*/
  * returns 0 on success, <0 on error*/
-static int replace_build(char* match, int nmatch, regmatch_t* pmatch,
+static int replace_build(const char* match, int nmatch, regmatch_t* pmatch,
 					struct subst_expr* se, struct sip_msg* msg, str* rpl)
 					struct subst_expr* se, struct sip_msg* msg, str* rpl)
 {
 {
 	int r;
 	int r;
@@ -386,12 +386,12 @@ error:
 
 
 
 
 /* WARNING: input must be 0 terminated! */
 /* WARNING: input must be 0 terminated! */
-struct replace_lst* subst_run(struct subst_expr* se, char* input,
+struct replace_lst* subst_run(struct subst_expr* se, const char* input,
 								struct sip_msg* msg)
 								struct sip_msg* msg)
 {
 {
 	struct replace_lst *head;
 	struct replace_lst *head;
 	struct replace_lst **crt;
 	struct replace_lst **crt;
-	char *p;
+	const char *p;
 	int r;
 	int r;
 	regmatch_t* pmatch;
 	regmatch_t* pmatch;
 	int nmatch;
 	int nmatch;
@@ -453,16 +453,16 @@ error:
 
 
 /* returns the substitution result in a str, input must be 0 term
 /* returns the substitution result in a str, input must be 0 term
  *  0 on no match or malloc error */ 
  *  0 on no match or malloc error */ 
-str* subst_str(char *input, struct sip_msg* msg, struct subst_expr* se)
+str* subst_str(const char *input, struct sip_msg* msg, struct subst_expr* se)
 {
 {
 	str* res;
 	str* res;
 	struct replace_lst *lst;
 	struct replace_lst *lst;
 	struct replace_lst* l;
 	struct replace_lst* l;
 	int len;
 	int len;
 	int size;
 	int size;
-	char* p;
+	const char* p;
 	char* dest;
 	char* dest;
-	char* end;
+	const char* end;
 	
 	
 	
 	
 	/* compute the len */
 	/* compute the len */

+ 2 - 2
re.h

@@ -73,9 +73,9 @@ struct replace_lst{
 void subst_expr_free(struct subst_expr* se);
 void subst_expr_free(struct subst_expr* se);
 void replace_lst_free(struct replace_lst* l);
 void replace_lst_free(struct replace_lst* l);
 struct subst_expr*  subst_parser(str* subst);
 struct subst_expr*  subst_parser(str* subst);
-struct replace_lst* subst_run( struct subst_expr* se, char* input, 
+struct replace_lst* subst_run( struct subst_expr* se, const char* input, 
 		                       struct sip_msg* msg);
 		                       struct sip_msg* msg);
-str* subst_str(char* input, struct sip_msg* msg, struct subst_expr* se);
+str* subst_str(const char* input, struct sip_msg* msg, struct subst_expr* se);