瀏覽代碼

some more `const's

Roberto Ierusalimschy 26 年之前
父節點
當前提交
8e7451512f
共有 6 個文件被更改,包括 17 次插入14 次删除
  1. 4 3
      ldo.c
  2. 2 2
      ldo.h
  3. 3 2
      lfunc.c
  4. 3 2
      lfunc.h
  5. 3 3
      lvm.c
  6. 2 2
      lvm.h

+ 4 - 3
ldo.c

@@ -1,5 +1,5 @@
 /*
-** $Id: ldo.c,v 1.48 1999/10/04 17:51:04 roberto Exp roberto $
+** $Id: ldo.c,v 1.49 1999/10/14 17:53:35 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 */
@@ -101,7 +101,7 @@ void luaD_lineHook (int line) {
 }
 
 
-void luaD_callHook (StkId base, TProtoFunc *tf, int isreturn) {
+void luaD_callHook (StkId base, const TProtoFunc *tf, int isreturn) {
   struct C_Lua_Stack oldCLS = L->Cstack;
   StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->stack.top-L->stack.stack;
   L->Cstack.num = 0;
@@ -143,7 +143,8 @@ static StkId callC (lua_CFunction f, StkId base) {
 }
 
 
-static StkId callCclosure (struct Closure *cl, lua_CFunction f, StkId base) {
+static StkId callCclosure (const struct Closure *cl,
+                           lua_CFunction f, StkId base) {
   TObject *pbase;
   int nup = cl->nelems;  /* number of upvalues */
   luaD_checkstack(nup);

+ 2 - 2
ldo.h

@@ -1,5 +1,5 @@
 /*
-** $Id: ldo.h,v 1.7 1999/08/16 20:52:00 roberto Exp roberto $
+** $Id: ldo.h,v 1.8 1999/10/04 17:51:04 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 */
@@ -34,7 +34,7 @@ void luaD_init (void);
 void luaD_adjusttop (StkId newtop);
 void luaD_openstack (int nelems);
 void luaD_lineHook (int line);
-void luaD_callHook (StkId base, TProtoFunc *tf, int isreturn);
+void luaD_callHook (StkId base, const TProtoFunc *tf, int isreturn);
 void luaD_calln (int nArgs, int nResults);
 void luaD_callTM (const TObject *f, int nParams, int nResults);
 int luaD_protectedrun (void);

+ 3 - 2
lfunc.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lfunc.c,v 1.11 1999/08/16 20:52:00 roberto Exp roberto $
+** $Id: lfunc.c,v 1.12 1999/10/04 17:51:04 roberto Exp roberto $
 ** Auxiliary functions to manipulate prototypes and closures
 ** See Copyright Notice in lua.h
 */
@@ -62,7 +62,8 @@ void luaF_freeclosure (Closure *c) {
 ** Look for n-th local variable at line "line" in function "func".
 ** Returns NULL if not found.
 */
-const char *luaF_getlocalname (TProtoFunc *func, int local_number, int line) {
+const char *luaF_getlocalname (const TProtoFunc *func,
+                               int local_number, int line) {
   int count = 0;
   const char *varname = NULL;
   LocVar *lv = func->locvars;

+ 3 - 2
lfunc.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lfunc.h,v 1.6 1999/08/16 20:52:00 roberto Exp roberto $
+** $Id: lfunc.h,v 1.7 1999/10/04 17:51:04 roberto Exp roberto $
 ** Lua Function structures
 ** See Copyright Notice in lua.h
 */
@@ -17,7 +17,8 @@ Closure *luaF_newclosure (int nelems);
 void luaF_freeproto (TProtoFunc *f);
 void luaF_freeclosure (Closure *c);
 
-const char *luaF_getlocalname (TProtoFunc *func, int local_number, int line);
+const char *luaF_getlocalname (const TProtoFunc *func,
+                               int local_number, int line);
 
 
 #endif

+ 3 - 3
lvm.c

@@ -1,5 +1,5 @@
 /*
-** $Id: lvm.c,v 1.62 1999/09/17 16:53:54 roberto Exp roberto $
+** $Id: lvm.c,v 1.63 1999/10/14 19:13:31 roberto Exp roberto $
 ** Lua virtual machine
 ** See Copyright Notice in lua.h
 */
@@ -35,7 +35,7 @@
 
 
 
-static TaggedString *strconc (TaggedString *l, TaggedString *r) {
+static TaggedString *strconc (const TaggedString *l, const TaggedString *r) {
   long nl = l->u.s.len;
   long nr = r->u.s.len;
   char *buffer = luaL_openspace(nl+nr);
@@ -296,7 +296,7 @@ static void adjust_varargs (StkId first_extra_arg) {
 ** [stack+base,top). Returns n such that the the results are between
 ** [stack+n,top).
 */
-StkId luaV_execute (Closure *cl, TProtoFunc *tf, StkId base) {
+StkId luaV_execute (const Closure *cl, const TProtoFunc *tf, StkId base) {
   struct Stack *S = &L->stack;  /* to optimize */
   register const Byte *pc = tf->code;
   const TObject *consts = tf->consts;

+ 2 - 2
lvm.h

@@ -1,5 +1,5 @@
 /*
-** $Id: lvm.h,v 1.8 1999/02/08 17:07:59 roberto Exp roberto $
+** $Id: lvm.h,v 1.9 1999/08/16 20:52:00 roberto Exp roberto $
 ** Lua virtual machine
 ** See Copyright Notice in lua.h
 */
@@ -26,7 +26,7 @@ void luaV_settable (const TObject *t);
 void luaV_rawsettable (const TObject *t);
 void luaV_getglobal (TaggedString *ts);
 void luaV_setglobal (TaggedString *ts);
-StkId luaV_execute (Closure *cl, TProtoFunc *tf, StkId base);
+StkId luaV_execute (const Closure *cl, const TProtoFunc *tf, StkId base);
 void luaV_closure (int nelems);
 void luaV_comparison (lua_Type ttype_less, lua_Type ttype_equal,
                       lua_Type ttype_great, IMS op);