summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2002-08-04 21:19:54 +0000
committerwtc%netscape.com <devnull@localhost>2002-08-04 21:19:54 +0000
commit49bba93ac717238da921603ece11637b2e3fe75f (patch)
treeb289c7917b57bd42abb52e89331e4db65d582f24
parentd406ad7ba97dc3a66e8d8ed4065303190a7d47c2 (diff)
downloadnss-hg-49bba93ac717238da921603ece11637b2e3fe75f.tar.gz
Add missing const qualifiers to NSS's regular expression match functions.
This is a prerequisite for landing the fix for bug 103752 on NSS_3_5_BRANCH.
-rw-r--r--security/nss/lib/util/portreg.c34
-rw-r--r--security/nss/lib/util/portreg.h9
2 files changed, 22 insertions, 21 deletions
diff --git a/security/nss/lib/util/portreg.c b/security/nss/lib/util/portreg.c
index 79d13d67c..41f217f76 100644
--- a/security/nss/lib/util/portreg.c
+++ b/security/nss/lib/util/portreg.c
@@ -46,7 +46,7 @@
static int
-_valid_subexp(char *exp, char stop)
+_valid_subexp(const char *exp, char stop)
{
register int x,y,t;
int nsc,np,tld;
@@ -116,7 +116,7 @@ _valid_subexp(char *exp, char stop)
}
int
-PORT_RegExpValid(char *exp)
+PORT_RegExpValid(const char *exp)
{
int x;
@@ -132,10 +132,10 @@ PORT_RegExpValid(char *exp)
#define NOMATCH 1
#define ABORTED -1
-static int _shexp_match(char *str, char *exp, PRBool case_insensitive);
+static int _shexp_match(const char *str, const char *exp, PRBool case_insensitive);
static int
-_handle_union(char *str, char *exp, PRBool case_insensitive)
+_handle_union(const char *str, const char *exp, PRBool case_insensitive)
{
char *e2 = (char *) PORT_Alloc(sizeof(char)*strlen(exp));
register int t,p2,p1 = 1;
@@ -165,7 +165,7 @@ _handle_union(char *str, char *exp, PRBool case_insensitive)
static int
-_shexp_match(char *str, char *exp, PRBool case_insensitive)
+_shexp_match(const char *str, const char *exp, PRBool case_insensitive)
{
register int x,y;
int ret,neg;
@@ -237,16 +237,16 @@ _shexp_match(char *str, char *exp, PRBool case_insensitive)
case '\\':
++y;
default:
- if(case_insensitive)
- {
+ if(case_insensitive)
+ {
if(toupper(str[x]) != toupper(exp[y]))
ret = NOMATCH;
- }
- else
- {
+ }
+ else
+ {
if(str[x] != exp[y])
ret = NOMATCH;
- }
+ }
break;
}
}
@@ -256,8 +256,8 @@ _shexp_match(char *str, char *exp, PRBool case_insensitive)
return (ret ? ret : (str[x] ? NOMATCH : MATCH));
}
-int
-PORT_RegExpMatch(char *str, char *xp, PRBool case_insensitive) {
+static int
+port_RegExpMatch(const char *str, const char *xp, PRBool case_insensitive) {
register int x;
char *exp = 0;
@@ -288,7 +288,7 @@ PORT_RegExpMatch(char *str, char *xp, PRBool case_insensitive) {
/* ------------------------------ shexp_cmp ------------------------------- */
int
-PORT_RegExpSearch(char *str, char *exp)
+PORT_RegExpSearch(const char *str, const char *exp)
{
switch(PORT_RegExpValid(exp))
{
@@ -297,12 +297,12 @@ PORT_RegExpSearch(char *str, char *exp)
case NON_SXP:
return (strcmp(exp,str) ? 1 : 0);
default:
- return PORT_RegExpMatch(str, exp, PR_FALSE);
+ return port_RegExpMatch(str, exp, PR_FALSE);
}
}
int
-PORT_RegExpCaseSearch(char *str, char *exp)
+PORT_RegExpCaseSearch(const char *str, const char *exp)
{
switch(PORT_RegExpValid(exp))
{
@@ -311,7 +311,7 @@ PORT_RegExpCaseSearch(char *str, char *exp)
case NON_SXP:
return (strcmp(exp,str) ? 1 : 0);
default:
- return PORT_RegExpMatch(str, exp, PR_TRUE);
+ return port_RegExpMatch(str, exp, PR_TRUE);
}
}
diff --git a/security/nss/lib/util/portreg.h b/security/nss/lib/util/portreg.h
index 39a2df9d5..420f404c7 100644
--- a/security/nss/lib/util/portreg.h
+++ b/security/nss/lib/util/portreg.h
@@ -81,11 +81,12 @@
SEC_BEGIN_PROTOS
-extern int PORT_RegExpValid(char *exp);
+extern int PORT_RegExpValid(const char *exp);
-/* same as above but uses case insensitive search
- */
-extern int PORT_RegExpCaseSearch(char *str, char *exp);
+extern int PORT_RegExpSearch(const char *str, const char *exp);
+
+/* same as above but uses case insensitive search */
+extern int PORT_RegExpCaseSearch(const char *str, const char *exp);
SEC_END_PROTOS