sizeof(string) != strlen(string)+1 when sizeof(char) != 1

This commit is contained in:
Roberto Ierusalimschy 2001-03-06 11:46:54 -03:00
parent 9e8a46daa2
commit e9a3820370
3 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/* /*
** $Id: ldebug.c,v 1.70 2001/02/23 20:30:52 roberto Exp roberto $ ** $Id: ldebug.c,v 1.71 2001/03/02 17:27:50 roberto Exp roberto $
** Debug Interface ** Debug Interface
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -223,7 +223,7 @@ static void funcinfo (lua_State *L, lua_Debug *ar, StkId func) {
} }
else else
infoLproto(ar, cl->f.l); infoLproto(ar, cl->f.l);
luaO_chunkid(ar->short_src, ar->source, sizeof(ar->short_src)); luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE);
if (ar->linedefined == 0) if (ar->linedefined == 0)
ar->what = l_s("main"); ar->what = l_s("main");
} }

4
llex.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: llex.c,v 1.80 2001/02/23 17:17:25 roberto Exp roberto $ ** $Id: llex.c,v 1.81 2001/02/23 20:32:16 roberto Exp roberto $
** Lexical Analyzer ** Lexical Analyzer
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -58,7 +58,7 @@ void luaX_checklimit (LexState *ls, int val, int limit, const l_char *msg) {
void luaX_syntaxerror (LexState *ls, const l_char *s, const l_char *token) { void luaX_syntaxerror (LexState *ls, const l_char *s, const l_char *token) {
l_char buff[MAXSRC]; l_char buff[MAXSRC];
luaO_chunkid(buff, getstr(ls->source), sizeof(buff)); luaO_chunkid(buff, getstr(ls->source), MAXSRC);
luaO_verror(ls->L, luaO_verror(ls->L,
l_s("%.99s;\n last token read: `%.30s' at line %d in %.80s"), l_s("%.99s;\n last token read: `%.30s' at line %d in %.80s"),
s, token, ls->linenumber, buff); s, token, ls->linenumber, buff);

4
llex.h
View File

@ -1,5 +1,5 @@
/* /*
** $Id: llex.h,v 1.33 2001/01/10 16:40:56 roberto Exp roberto $ ** $Id: llex.h,v 1.34 2001/02/23 17:17:25 roberto Exp roberto $
** Lexical Analyzer ** Lexical Analyzer
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -14,7 +14,7 @@
#define FIRST_RESERVED 257 #define FIRST_RESERVED 257
/* maximum length of a reserved word */ /* maximum length of a reserved word */
#define TOKEN_LEN (sizeof(l_s("function"))) #define TOKEN_LEN (sizeof(l_s("function"))/sizeof(l_char))
/* /*