diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-02-22 17:34:33 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-02-22 17:34:33 -0300 |
commit | 8c1a9899d4460aa19780919f4245c08d7ebba0e9 (patch) | |
tree | 685817907f64133330011eb7db845830c9327a3e /func.c | |
parent | 05caf09a36cadaab401bc9a24e29e2cd6e4126d4 (diff) | |
download | lua-8c1a9899d4460aa19780919f4245c08d7ebba0e9.tar.gz lua-8c1a9899d4460aa19780919f4245c08d7ebba0e9.tar.bz2 lua-8c1a9899d4460aa19780919f4245c08d7ebba0e9.zip |
functions "luaI_free" and "luaI_realloc" (or macro "growvector") may be
called with NULL.
Diffstat (limited to 'func.c')
-rw-r--r-- | func.c | 17 |
1 files changed, 5 insertions, 12 deletions
@@ -42,8 +42,7 @@ void luaI_insertfunction (TFunc *f) | |||
42 | static void freefunc (TFunc *f) | 42 | static void freefunc (TFunc *f) |
43 | { | 43 | { |
44 | luaI_free (f->code); | 44 | luaI_free (f->code); |
45 | if (f->locvars) | 45 | luaI_free (f->locvars); |
46 | luaI_free (f->locvars); | ||
47 | luaI_free (f); | 46 | luaI_free (f); |
48 | } | 47 | } |
49 | 48 | ||
@@ -100,16 +99,10 @@ void lua_funcinfo (lua_Object func, char **filename, int *linedefined) | |||
100 | void luaI_registerlocalvar (TaggedString *varname, int line) | 99 | void luaI_registerlocalvar (TaggedString *varname, int line) |
101 | { | 100 | { |
102 | if (numcurrvars >= maxcurrvars) | 101 | if (numcurrvars >= maxcurrvars) |
103 | if (currvars == NULL) | 102 | { |
104 | { | 103 | maxcurrvars = (maxcurrvars == 0) ? LOCALVARINITSIZE : maxcurrvars*2; |
105 | maxcurrvars = LOCALVARINITSIZE; | 104 | currvars = growvector(currvars, maxcurrvars, LocVar); |
106 | currvars = newvector (maxcurrvars, LocVar); | 105 | } |
107 | } | ||
108 | else | ||
109 | { | ||
110 | maxcurrvars *= 2; | ||
111 | currvars = growvector (currvars, maxcurrvars, LocVar); | ||
112 | } | ||
113 | currvars[numcurrvars].varname = varname; | 106 | currvars[numcurrvars].varname = varname; |
114 | currvars[numcurrvars].line = line; | 107 | currvars[numcurrvars].line = line; |
115 | numcurrvars++; | 108 | numcurrvars++; |