diff options
| -rw-r--r-- | lstring.c | 7 | ||||
| -rw-r--r-- | lstring.h | 6 |
2 files changed, 8 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstring.c,v 2.15 2009/12/11 21:31:14 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 2.16 2009/12/16 16:42:58 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 | */ |
| @@ -94,6 +94,11 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { | |||
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | 96 | ||
| 97 | TString *luaS_new (lua_State *L, const char *str) { | ||
| 98 | return luaS_newlstr(L, str, strlen(str)); | ||
| 99 | } | ||
| 100 | |||
| 101 | |||
| 97 | Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { | 102 | Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { |
| 98 | Udata *u; | 103 | Udata *u; |
| 99 | if (s > MAX_SIZET - sizeof(Udata)) | 104 | if (s > MAX_SIZET - sizeof(Udata)) |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstring.h,v 1.43 2005/04/25 19:24:10 roberto Exp roberto $ | 2 | ** $Id: lstring.h,v 1.44 2010/03/13 15:55:01 roberto Exp roberto $ |
| 3 | ** String table (keep all strings handled by Lua) | 3 | ** String table (keep all strings handled by Lua) |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -7,8 +7,6 @@ | |||
| 7 | #ifndef lstring_h | 7 | #ifndef lstring_h |
| 8 | #define lstring_h | 8 | #define lstring_h |
| 9 | 9 | ||
| 10 | #include <string.h> | ||
| 11 | |||
| 12 | #include "lgc.h" | 10 | #include "lgc.h" |
| 13 | #include "lobject.h" | 11 | #include "lobject.h" |
| 14 | #include "lstate.h" | 12 | #include "lstate.h" |
| @@ -18,7 +16,6 @@ | |||
| 18 | 16 | ||
| 19 | #define sizeudata(u) (sizeof(union Udata)+(u)->len) | 17 | #define sizeudata(u) (sizeof(union Udata)+(u)->len) |
| 20 | 18 | ||
| 21 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) | ||
| 22 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ | 19 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ |
| 23 | (sizeof(s)/sizeof(char))-1)) | 20 | (sizeof(s)/sizeof(char))-1)) |
| 24 | 21 | ||
| @@ -27,6 +24,7 @@ | |||
| 27 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); | 24 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); |
| 28 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); | 25 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); |
| 29 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); | 26 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); |
| 27 | LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); | ||
| 30 | 28 | ||
| 31 | 29 | ||
| 32 | #endif | 30 | #endif |
