diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-12-30 17:15:52 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-12-30 17:15:52 -0200 |
| commit | 90d87e3a78e567f3db307d2c90a63386c881c68d (patch) | |
| tree | 6d6def73e40cd170079c6339988af171b75c9f20 /lstring.c | |
| parent | f76bca23ef1f45d3533f16285e223408346ddcaa (diff) | |
| download | lua-90d87e3a78e567f3db307d2c90a63386c881c68d.tar.gz lua-90d87e3a78e567f3db307d2c90a63386c881c68d.tar.bz2 lua-90d87e3a78e567f3db307d2c90a63386c881c68d.zip | |
details
Diffstat (limited to 'lstring.c')
| -rw-r--r-- | lstring.c | 7 |
1 files changed, 2 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstring.c,v 1.7 1997/12/01 20:31:25 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 1.8 1997/12/09 13:35:19 roberto Exp roberto $ |
| 3 | ** String table (keeps all strings handled by Lua) | 3 | ** String table (keeps all strings handled by Lua) |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -106,16 +106,13 @@ static TaggedString *insert (char *buff, int tag, stringtable *tb) | |||
| 106 | int j = -1; | 106 | int j = -1; |
| 107 | if ((long)tb->nuse*3 >= (long)tb->size*2) | 107 | if ((long)tb->nuse*3 >= (long)tb->size*2) |
| 108 | grow(tb); | 108 | grow(tb); |
| 109 | i = h%tb->size; | 109 | for (i = h%tb->size; (ts = tb->hash[i]) != NULL; i = (i+1)%tb->size) { |
| 110 | while ((ts = tb->hash[i]) != NULL) | ||
| 111 | { | ||
| 112 | if (ts == &EMPTY) | 110 | if (ts == &EMPTY) |
| 113 | j = i; | 111 | j = i; |
| 114 | else if ((ts->constindex >= 0) ? /* is a string? */ | 112 | else if ((ts->constindex >= 0) ? /* is a string? */ |
| 115 | (tag == LUA_T_STRING && (strcmp(buff, ts->str) == 0)) : | 113 | (tag == LUA_T_STRING && (strcmp(buff, ts->str) == 0)) : |
| 116 | ((tag == ts->u.d.tag || tag == LUA_ANYTAG) && buff == ts->u.d.v)) | 114 | ((tag == ts->u.d.tag || tag == LUA_ANYTAG) && buff == ts->u.d.v)) |
| 117 | return ts; | 115 | return ts; |
| 118 | i = (i+1)%tb->size; | ||
| 119 | } | 116 | } |
| 120 | /* not found */ | 117 | /* not found */ |
| 121 | if (j != -1) /* is there an EMPTY space? */ | 118 | if (j != -1) /* is there an EMPTY space? */ |
