aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornop <nop>1999-08-09 02:36:33 +0000
committernop <nop>1999-08-09 02:36:33 +0000
commitc7dee811b1a1e86d86791e149b17f9a14f793957 (patch)
treed548b6c0d38868b55eb6a344d015bce869b08b5e
parent30de78a6ae53a2338c282e46c89c857073588ad5 (diff)
downloadmoo-c7dee811b1a1e86d86791e149b17f9a14f793957.tar.gz
moo-c7dee811b1a1e86d86791e149b17f9a14f793957.tar.xz
moo-c7dee811b1a1e86d86791e149b17f9a14f793957.zip
Shortcut various equality tests if we have pointer equality.
-rw-r--r--utils.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/utils.c b/utils.c
index 61a5ad8..a90be44 100644
--- a/utils.c
+++ b/utils.c
@@ -63,6 +63,9 @@ mystrcasecmp(const char *ss, const char *tt)
const unsigned char *s = (const unsigned char *) ss;
const unsigned char *t = (const unsigned char *) tt;
+ if (ss == tt) {
+ return 0;
+ }
while (cmap[*s] == cmap[*t++]) {
if (!*s++)
return 0;
@@ -76,7 +79,7 @@ mystrncasecmp(const char *ss, const char *tt, int n)
const unsigned char *s = (const unsigned char *) ss;
const unsigned char *t = (const unsigned char *) tt;
- if (!n)
+ if (!n || ss == tt)
return 0;
while (cmap[*s] == cmap[*t++]) {
if (!*s++ || !--n)
@@ -94,6 +97,9 @@ verbcasecmp(const char *verb, const char *word)
none, inner, end
} star;
+ if (verb == word) {
+ return 1;
+ }
while (*v) {
w = (const unsigned char *) word;
star = none;
@@ -254,6 +260,9 @@ equality(Var lhs, Var rhs, int case_matters)
else {
int i;
+ if (lhs.v.list == rhs.v.list) {
+ return 1;
+ }
for (i = 1; i <= lhs.v.list[0].v.num; i++) {
if (!equality(lhs.v.list[i], rhs.v.list[i], case_matters))
return 0;
@@ -437,6 +446,9 @@ char rcsid_utils[] = "$Id$";
/*
* $Log$
+ * Revision 1.5 1999/08/09 02:36:33 nop
+ * Shortcut various equality tests if we have pointer equality.
+ *
* Revision 1.4 1998/12/14 13:19:14 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*