diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-03-21 13:33:47 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-03-21 13:33:47 -0300 |
| commit | 9284742a11b92dfe4ef011b963240cfa588515cd (patch) | |
| tree | 96cc498fcc5ec27546fc0738998319c829df55d0 /func.c | |
| parent | 9704ff4cb14f34077062447d15196d32ace23e95 (diff) | |
| download | lua-9284742a11b92dfe4ef011b963240cfa588515cd.tar.gz lua-9284742a11b92dfe4ef011b963240cfa588515cd.tar.bz2 lua-9284742a11b92dfe4ef011b963240cfa588515cd.zip | |
better control when growing arrays.
Diffstat (limited to 'func.c')
| -rw-r--r-- | func.c | 7 |
1 files changed, 2 insertions, 5 deletions
| @@ -6,7 +6,6 @@ | |||
| 6 | #include "func.h" | 6 | #include "func.h" |
| 7 | #include "opcode.h" | 7 | #include "opcode.h" |
| 8 | 8 | ||
| 9 | #define LOCALVARINITSIZE 10 | ||
| 10 | 9 | ||
| 11 | static TFunc *function_root = NULL; | 10 | static TFunc *function_root = NULL; |
| 12 | static LocVar *currvars = NULL; | 11 | static LocVar *currvars = NULL; |
| @@ -103,10 +102,8 @@ void lua_funcinfo (lua_Object func, char **filename, int *linedefined) | |||
| 103 | void luaI_registerlocalvar (TaggedString *varname, int line) | 102 | void luaI_registerlocalvar (TaggedString *varname, int line) |
| 104 | { | 103 | { |
| 105 | if (numcurrvars >= maxcurrvars) | 104 | if (numcurrvars >= maxcurrvars) |
| 106 | { | 105 | maxcurrvars = growvector(&currvars, maxcurrvars, LocVar, |
| 107 | maxcurrvars = (maxcurrvars == 0) ? LOCALVARINITSIZE : maxcurrvars*2; | 106 | lockEM, MAX_WORD); |
| 108 | currvars = growvector(currvars, maxcurrvars, LocVar); | ||
| 109 | } | ||
| 110 | currvars[numcurrvars].varname = varname; | 107 | currvars[numcurrvars].varname = varname; |
| 111 | currvars[numcurrvars].line = line; | 108 | currvars[numcurrvars].line = line; |
| 112 | numcurrvars++; | 109 | numcurrvars++; |
