details
This commit is contained in:
8
liolib.c
8
liolib.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: liolib.c,v 1.96 2000/12/22 17:32:28 roberto Exp roberto $
|
** $Id: liolib.c,v 1.97 2001/01/10 16:58:11 roberto Exp roberto $
|
||||||
** Standard I/O (and system) library
|
** Standard I/O (and system) library
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -278,7 +278,7 @@ static int read_line (lua_State *L, FILE *f) {
|
|||||||
|
|
||||||
static void read_file (lua_State *L, FILE *f) {
|
static void read_file (lua_State *L, FILE *f) {
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
size_t size = BUFSIZ;
|
size_t size = LUAL_BUFFERSIZE;
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
char *newbuffer = (char *)realloc(buffer, size);
|
char *newbuffer = (char *)realloc(buffer, size);
|
||||||
@@ -299,8 +299,8 @@ static void read_file (lua_State *L, FILE *f) {
|
|||||||
static int read_chars (lua_State *L, FILE *f, size_t n) {
|
static int read_chars (lua_State *L, FILE *f, size_t n) {
|
||||||
char *buffer;
|
char *buffer;
|
||||||
size_t n1;
|
size_t n1;
|
||||||
char statbuff[BUFSIZ];
|
char statbuff[LUAL_BUFFERSIZE];
|
||||||
if (n <= BUFSIZ)
|
if (n <= LUAL_BUFFERSIZE)
|
||||||
buffer = statbuff;
|
buffer = statbuff;
|
||||||
else {
|
else {
|
||||||
buffer = (char *)malloc(n);
|
buffer = (char *)malloc(n);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lstring.c,v 1.48 2000/12/28 12:55:41 roberto Exp roberto $
|
** $Id: lstring.c,v 1.49 2001/01/10 17:41:50 roberto Exp roberto $
|
||||||
** String table (keeps all strings handled by Lua)
|
** String table (keeps all strings handled by Lua)
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -43,7 +43,7 @@ void luaS_resize (lua_State *L, stringtable *tb, int newsize) {
|
|||||||
TString *next = p->nexthash; /* save next */
|
TString *next = p->nexthash; /* save next */
|
||||||
luint32 h = (tb == &L->strt) ? p->u.s.hash : IntPoint(p->u.d.value);
|
luint32 h = (tb == &L->strt) ? p->u.s.hash : IntPoint(p->u.d.value);
|
||||||
int h1 = lmod(h, newsize); /* new position */
|
int h1 = lmod(h, newsize); /* new position */
|
||||||
LUA_ASSERT(h%newsize == lmod(h, newsize),
|
LUA_ASSERT((int)(h%newsize) == lmod(h, newsize),
|
||||||
"a&(x-1) == a%x, for x power of 2");
|
"a&(x-1) == a%x, for x power of 2");
|
||||||
p->nexthash = newhash[h1]; /* chain it in new position */
|
p->nexthash = newhash[h1]; /* chain it in new position */
|
||||||
newhash[h1] = p;
|
newhash[h1] = p;
|
||||||
|
|||||||
Reference in New Issue
Block a user