diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-08-31 16:46:07 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-08-31 16:46:07 -0300 |
| commit | e1d072571ec6f9d830e575a2ecdc95fd43428e53 (patch) | |
| tree | 830fab7f2acb9adaee2d63073d339cc9557a5437 /lstring.c | |
| parent | 7651a5c6b2ee6ec59cadec6199319d482071f176 (diff) | |
| download | lua-e1d072571ec6f9d830e575a2ecdc95fd43428e53.tar.gz lua-e1d072571ec6f9d830e575a2ecdc95fd43428e53.tar.bz2 lua-e1d072571ec6f9d830e575a2ecdc95fd43428e53.zip | |
better syntax for type casts
Diffstat (limited to 'lstring.c')
| -rw-r--r-- | lstring.c | 10 |
1 files changed, 5 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstring.c,v 1.65 2001/06/15 20:36:57 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 1.66 2001/08/27 15:16:28 roberto Exp $ |
| 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 | */ |
| @@ -35,7 +35,7 @@ void luaS_resize (lua_State *L, int newsize) { | |||
| 35 | TString *next = p->tsv.nexthash; /* save next */ | 35 | TString *next = p->tsv.nexthash; /* save next */ |
| 36 | lu_hash h = p->tsv.hash; | 36 | lu_hash h = p->tsv.hash; |
| 37 | int h1 = lmod(h, newsize); /* new position */ | 37 | int h1 = lmod(h, newsize); /* new position */ |
| 38 | lua_assert((int)(h%newsize) == lmod(h, newsize)); | 38 | lua_assert(cast(int, h%newsize) == lmod(h, newsize)); |
| 39 | p->tsv.nexthash = newhash[h1]; /* chain it in new position */ | 39 | p->tsv.nexthash = newhash[h1]; /* chain it in new position */ |
| 40 | newhash[h1] = p; | 40 | newhash[h1] = p; |
| 41 | p = next; | 41 | p = next; |
| @@ -48,7 +48,7 @@ void luaS_resize (lua_State *L, int newsize) { | |||
| 48 | 48 | ||
| 49 | 49 | ||
| 50 | static TString *newlstr (lua_State *L, const l_char *str, size_t l, lu_hash h) { | 50 | static TString *newlstr (lua_State *L, const l_char *str, size_t l, lu_hash h) { |
| 51 | TString *ts = (TString *)luaM_malloc(L, sizestring(l)); | 51 | TString *ts = cast(TString *, luaM_malloc(L, sizestring(l))); |
| 52 | stringtable *tb; | 52 | stringtable *tb; |
| 53 | ts->tsv.nexthash = NULL; | 53 | ts->tsv.nexthash = NULL; |
| 54 | ts->tsv.len = l; | 54 | ts->tsv.len = l; |
| @@ -61,7 +61,7 @@ static TString *newlstr (lua_State *L, const l_char *str, size_t l, lu_hash h) { | |||
| 61 | ts->tsv.nexthash = tb->hash[h]; /* chain new entry */ | 61 | ts->tsv.nexthash = tb->hash[h]; /* chain new entry */ |
| 62 | tb->hash[h] = ts; | 62 | tb->hash[h] = ts; |
| 63 | tb->nuse++; | 63 | tb->nuse++; |
| 64 | if (tb->nuse > (ls_nstr)tb->size && tb->size <= MAX_INT/2) | 64 | if (tb->nuse > cast(ls_nstr, tb->size) && tb->size <= MAX_INT/2) |
| 65 | luaS_resize(L, tb->size*2); /* too crowded */ | 65 | luaS_resize(L, tb->size*2); /* too crowded */ |
| 66 | return ts; | 66 | return ts; |
| 67 | } | 67 | } |
| @@ -85,7 +85,7 @@ TString *luaS_newlstr (lua_State *L, const l_char *str, size_t l) { | |||
| 85 | 85 | ||
| 86 | 86 | ||
| 87 | Udata *luaS_newudata (lua_State *L, size_t s) { | 87 | Udata *luaS_newudata (lua_State *L, size_t s) { |
| 88 | Udata *u = (Udata *)luaM_malloc(L, sizeudata(s)); | 88 | Udata *u = cast(Udata *, luaM_malloc(L, sizeudata(s))); |
| 89 | u->uv.len = s; | 89 | u->uv.len = s; |
| 90 | u->uv.tag = 0; | 90 | u->uv.tag = 0; |
| 91 | u->uv.value = u + 1; | 91 | u->uv.value = u + 1; |
