From 82ad0d57705dd3be41081118781762b72e334f1b Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 11 Mar 1999 15:59:19 -0300 Subject: [PATCH] details --- lauxlib.c | 8 +++----- ldo.c | 6 +++--- liolib.c | 4 ++-- llex.c | 4 ++-- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/lauxlib.c b/lauxlib.c index a46591a1..a7746bbe 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.c,v 1.15 1999/03/04 21:17:26 roberto Exp roberto $ +** $Id: lauxlib.c,v 1.16 1999/03/10 14:19:41 roberto Exp roberto $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -128,8 +128,6 @@ void luaL_chunkid (char *out, char *source, int len) { void luaL_filesource (char *out, char *filename, int len) { - if (filename == NULL) - strcpy(out, "@(stdin)"); - else - sprintf(out, "@%.*s", len-2, filename); /* -2 for '@' and '\0' */ + if (filename == NULL) filename = "(stdin)"; + sprintf(out, "@%.*s", len-2, filename); /* -2 for '@' and '\0' */ } diff --git a/ldo.c b/ldo.c index 2ae3673e..6a012fe7 100644 --- a/ldo.c +++ b/ldo.c @@ -1,5 +1,5 @@ /* -** $Id: ldo.c,v 1.39 1999/03/10 14:19:41 roberto Exp roberto $ +** $Id: ldo.c,v 1.40 1999/03/10 14:23:07 roberto Exp roberto $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -356,7 +356,7 @@ void luaD_gcIM (TObject *o) } -#define MAXFILENAME 200 /* maximum part of a file name kept */ +#define MAXFILENAME 260 /* maximum part of a file name kept */ int lua_dofile (char *filename) { ZIO z; @@ -372,7 +372,7 @@ int lua_dofile (char *filename) { bin = (c == ID_CHUNK); if (bin) f = freopen(filename, "rb", f); /* set binary mode */ - luaL_filesource(source, filename, MAXFILENAME); + luaL_filesource(source, filename, sizeof(source)); luaZ_Fopen(&z, f, source); status = do_main(&z, bin); if (f != stdin) diff --git a/liolib.c b/liolib.c index c430c155..e23265dc 100644 --- a/liolib.c +++ b/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 1.32 1999/03/04 21:17:26 roberto Exp roberto $ +** $Id: liolib.c,v 1.33 1999/03/05 20:45:01 roberto Exp roberto $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -471,7 +471,7 @@ static void errorfb (void) { char buffchunk[MAXSRC]; int linedefined; lua_funcinfo(func, &chunkname, &linedefined); - luaL_chunkid(buffchunk, chunkname, MAXSRC); + luaL_chunkid(buffchunk, chunkname, sizeof(buffchunk)); if (level == 2) strcat(buff, "Active Stack:\n"); strcat(buff, "\t"); if (strlen(buff) > MAXMESSAGE-MESSAGESIZE) { diff --git a/llex.c b/llex.c index 16ed522e..0080a219 100644 --- a/llex.c +++ b/llex.c @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 1.31 1999/03/04 21:17:26 roberto Exp roberto $ +** $Id: llex.c,v 1.32 1999/03/05 20:45:01 roberto Exp roberto $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -45,7 +45,7 @@ void luaX_init (void) { void luaX_syntaxerror (LexState *ls, char *s, char *token) { char buff[MAXSRC]; - luaL_chunkid(buff, zname(ls->lex_z), MAXSRC); + luaL_chunkid(buff, zname(ls->lex_z), sizeof(buff)); if (token[0] == '\0') token = ""; luaL_verror("%.100s;\n last token read: `%.50s' at line %d in %.50s",