diff options
author | Andi Gutmans <andi@php.net> | 2000-02-13 15:59:32 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2000-02-13 15:59:32 +0000 |
commit | bac7a5085e34338cda2af215728c5375a57ffc35 (patch) | |
tree | 9114c8132b1adba0caaade5026811642e7c6634e | |
parent | 7441ee51757026543eb54abbb5a2e690ecc68f1f (diff) | |
download | php-git-bac7a5085e34338cda2af215728c5375a57ffc35.tar.gz |
- Not sure if len can be zero but it's better to check it once then
rechecking for it every loop and having an extra variable do nothing.
-rw-r--r-- | ext/standard/string.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c index 3426a4bf85..7614b78745 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2148,7 +2148,7 @@ PHP_FUNCTION(parse_str) */ int php_tag_find(char *tag, int len, char *set) { char c, *n, *t; - int i=0, state=0, done=0; + int state=0, done=0; char *norm = emalloc(len+1); n = norm; @@ -2159,7 +2159,10 @@ int php_tag_find(char *tag, int len, char *set) { and turn any <a whatever...> into just <a> and any </tag> into <tag> */ - while(i<len && !done) { + if (!len) { + return 0; + } + while(!done) { switch(c) { case '<': *(n++) = c; |