Browse Source

small 'improvement'

Roberto Ierusalimschy 28 years ago
parent
commit
e77534c08f
1 changed files with 2 additions and 3 deletions
  1. 2 3
      tree.c

+ 2 - 3
tree.c

@@ -3,7 +3,7 @@
 ** TecCGraf - PUC-Rio
 ** TecCGraf - PUC-Rio
 */
 */
  
  
-char *rcs_tree="$Id: tree.c,v 1.26 1997/05/14 18:38:29 roberto Exp roberto $";
+char *rcs_tree="$Id: tree.c,v 1.27 1997/06/09 17:28:14 roberto Exp roberto $";
 
 
 
 
 #include <string.h>
 #include <string.h>
@@ -39,9 +39,8 @@ static unsigned long hash (char *s, int tag)
   if (tag != LUA_T_STRING)
   if (tag != LUA_T_STRING)
     h = (unsigned long)s;
     h = (unsigned long)s;
   else {
   else {
-    long size = strlen(s);
     h = 0;
     h = 0;
-    while (size--)
+    while (*s)
       h = ((h<<5)-h)^(unsigned char)*(s++);
       h = ((h<<5)-h)^(unsigned char)*(s++);
   }
   }
   return h;
   return h;