]> granicus.if.org Git - php/commitdiff
- Not sure if len can be zero but it's better to check it once then
authorAndi Gutmans <andi@php.net>
Sun, 13 Feb 2000 15:59:32 +0000 (15:59 +0000)
committerAndi Gutmans <andi@php.net>
Sun, 13 Feb 2000 15:59:32 +0000 (15:59 +0000)
  rechecking for it every loop and having an extra variable do nothing.

ext/standard/string.c

index 3426a4bf85ad4cf9ccf82d508e26f56a13024ca7..7614b78745a843e2f29ad393725f1cf1f57a8727 100644 (file)
@@ -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;