summaryrefslogtreecommitdiff
path: root/src/util/SKBinTree.c
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-10-13 13:56:07 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-10-13 13:56:07 +0000
commit705fe5a2d4b2945f2aa23404e1f9f34f96924e5c (patch)
tree327fc39a99d0c1d62570ff5bf0690a0a51d772c6 /src/util/SKBinTree.c
parent2a2ef8b0757b8e04b2a6d3b7bab46826f4176adc (diff)
STR_cmpi returns immediately if the two string are a different length. The
return code in that case indicates which is longer. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1018 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/util/SKBinTree.c')
-rw-r--r--src/util/SKBinTree.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/util/SKBinTree.c b/src/util/SKBinTree.c
index fb55d5bf..be21b7dd 100644
--- a/src/util/SKBinTree.c
+++ b/src/util/SKBinTree.c
@@ -291,7 +291,8 @@ t_sktree *SKTreeFindFirst(t_sktree *root)
@calls
@calledby
@history
-
+ @hdate Wed Oct 13 15:30:57 1999 @hauthor Tom Goodale
+ @hdesc Checks the length of the two string first.
@endhistory
@@*/
@@ -299,16 +300,19 @@ int STR_cmpi(const char *string1, const char *string2)
{
int retval;
int position;
+
+ retval = strlen(string1) - strlen(string2);
- retval = 1;
-
- for(position = 0;
- position < strlen(string1)+1 && position < strlen(string2)+1;
- position++)
+ if(! retval)
{
- if((retval = (tolower(string1[position]) - tolower(string2[position]))))
+ for(position = 0;
+ string1[position] && string2[position];
+ position++)
{
- break;
+ if((retval = (tolower(string1[position]) - tolower(string2[position]))))
+ {
+ break;
+ }
}
}