diff options
Diffstat (limited to 'lstrlib.c')
-rw-r--r-- | lstrlib.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.111 2005/03/22 16:54:29 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.112 2005/05/05 15:34:03 roberto Exp roberto $ |
3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -525,8 +525,8 @@ static int str_find (lua_State *L) { | |||
525 | 525 | ||
526 | static int gfind_aux (lua_State *L) { | 526 | static int gfind_aux (lua_State *L) { |
527 | MatchState ms; | 527 | MatchState ms; |
528 | const char *s = lua_tostring(L, lua_upvalueindex(1)); | 528 | size_t ls; |
529 | size_t ls = lua_strlen(L, lua_upvalueindex(1)); | 529 | const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls); |
530 | const char *p = lua_tostring(L, lua_upvalueindex(2)); | 530 | const char *p = lua_tostring(L, lua_upvalueindex(2)); |
531 | const char *src; | 531 | const char *src; |
532 | ms.L = L; | 532 | ms.L = L; |
@@ -563,8 +563,8 @@ static void add_s (MatchState *ms, luaL_Buffer *b, | |||
563 | const char *s, const char *e) { | 563 | const char *s, const char *e) { |
564 | lua_State *L = ms->L; | 564 | lua_State *L = ms->L; |
565 | if (lua_isstring(L, 3)) { | 565 | if (lua_isstring(L, 3)) { |
566 | const char *news = lua_tostring(L, 3); | 566 | size_t l; |
567 | size_t l = lua_strlen(L, 3); | 567 | const char *news = lua_tolstring(L, 3, &l); |
568 | size_t i; | 568 | size_t i; |
569 | for (i=0; i<l; i++) { | 569 | for (i=0; i<l; i++) { |
570 | if (news[i] != L_ESC) | 570 | if (news[i] != L_ESC) |