aboutsummaryrefslogtreecommitdiff
path: root/lfunc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-08-16 17:52:00 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-08-16 17:52:00 -0300
commitc787dccd9b5c3e55547a2c4bb598c0276de65034 (patch)
treec4cdf2f7319fee48e048472a2044119f541e8da2 /lfunc.c
parentb44e35b773bcaa9891d80a117392911ab5f656e5 (diff)
downloadlua-c787dccd9b5c3e55547a2c4bb598c0276de65034.tar.gz
lua-c787dccd9b5c3e55547a2c4bb598c0276de65034.tar.bz2
lua-c787dccd9b5c3e55547a2c4bb598c0276de65034.zip
"const" !!!
Diffstat (limited to 'lfunc.c')
-rw-r--r--lfunc.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/lfunc.c b/lfunc.c
index e1bdd2bd..32fefb29 100644
--- a/lfunc.c
+++ b/lfunc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lfunc.c,v 1.9 1998/06/19 16:14:09 roberto Exp roberto $ 2** $Id: lfunc.c,v 1.10 1999/03/04 21:17:26 roberto Exp roberto $
3** Auxiliary functions to manipulate prototypes and closures 3** Auxiliary functions to manipulate prototypes and closures
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -16,8 +16,7 @@
16 16
17 17
18 18
19Closure *luaF_newclosure (int nelems) 19Closure *luaF_newclosure (int nelems) {
20{
21 Closure *c = (Closure *)luaM_malloc(sizeof(Closure)+nelems*sizeof(TObject)); 20 Closure *c = (Closure *)luaM_malloc(sizeof(Closure)+nelems*sizeof(TObject));
22 luaO_insertlist(&(L->rootcl), (GCnode *)c); 21 luaO_insertlist(&(L->rootcl), (GCnode *)c);
23 L->nblocks += gcsizeclosure(c); 22 L->nblocks += gcsizeclosure(c);
@@ -26,8 +25,7 @@ Closure *luaF_newclosure (int nelems)
26} 25}
27 26
28 27
29TProtoFunc *luaF_newproto (void) 28TProtoFunc *luaF_newproto (void) {
30{
31 TProtoFunc *f = luaM_new(TProtoFunc); 29 TProtoFunc *f = luaM_new(TProtoFunc);
32 f->code = NULL; 30 f->code = NULL;
33 f->lineDefined = 0; 31 f->lineDefined = 0;
@@ -42,8 +40,7 @@ TProtoFunc *luaF_newproto (void)
42 40
43 41
44 42
45static void freefunc (TProtoFunc *f) 43static void freefunc (TProtoFunc *f) {
46{
47 luaM_free(f->code); 44 luaM_free(f->code);
48 luaM_free(f->locvars); 45 luaM_free(f->locvars);
49 luaM_free(f->consts); 46 luaM_free(f->consts);
@@ -51,8 +48,7 @@ static void freefunc (TProtoFunc *f)
51} 48}
52 49
53 50
54void luaF_freeproto (TProtoFunc *l) 51void luaF_freeproto (TProtoFunc *l) {
55{
56 while (l) { 52 while (l) {
57 TProtoFunc *next = (TProtoFunc *)l->head.next; 53 TProtoFunc *next = (TProtoFunc *)l->head.next;
58 L->nblocks -= gcsizeproto(l); 54 L->nblocks -= gcsizeproto(l);
@@ -62,8 +58,7 @@ void luaF_freeproto (TProtoFunc *l)
62} 58}
63 59
64 60
65void luaF_freeclosure (Closure *l) 61void luaF_freeclosure (Closure *l) {
66{
67 while (l) { 62 while (l) {
68 Closure *next = (Closure *)l->head.next; 63 Closure *next = (Closure *)l->head.next;
69 L->nblocks -= gcsizeclosure(l); 64 L->nblocks -= gcsizeclosure(l);
@@ -77,10 +72,9 @@ void luaF_freeclosure (Closure *l)
77** Look for n-th local variable at line "line" in function "func". 72** Look for n-th local variable at line "line" in function "func".
78** Returns NULL if not found. 73** Returns NULL if not found.
79*/ 74*/
80char *luaF_getlocalname (TProtoFunc *func, int local_number, int line) 75const char *luaF_getlocalname (TProtoFunc *func, int local_number, int line) {
81{
82 int count = 0; 76 int count = 0;
83 char *varname = NULL; 77 const char *varname = NULL;
84 LocVar *lv = func->locvars; 78 LocVar *lv = func->locvars;
85 if (lv == NULL) 79 if (lv == NULL)
86 return NULL; 80 return NULL;