aboutsummaryrefslogtreecommitdiff
path: root/lobject.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 /lobject.c
parentb44e35b773bcaa9891d80a117392911ab5f656e5 (diff)
downloadlua-c787dccd9b5c3e55547a2c4bb598c0276de65034.tar.gz
lua-c787dccd9b5c3e55547a2c4bb598c0276de65034.tar.bz2
lua-c787dccd9b5c3e55547a2c4bb598c0276de65034.zip
"const" !!!
Diffstat (limited to 'lobject.c')
-rw-r--r--lobject.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/lobject.c b/lobject.c
index 840e367f..15775942 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.c,v 1.18 1999/02/26 15:48:30 roberto Exp roberto $ 2** $Id: lobject.c,v 1.19 1999/04/13 19:28:49 roberto Exp roberto $
3** Some generic functions over Lua objects 3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -11,25 +11,24 @@
11#include "lua.h" 11#include "lua.h"
12 12
13 13
14char *luaO_typenames[] = { /* ORDER LUA_T */ 14const char *const luaO_typenames[] = { /* ORDER LUA_T */
15 "userdata", "number", "string", "table", "function", "function", 15 "userdata", "number", "string", "table", "function", "function",
16 "nil", "function", "mark", "mark", "mark", "line", NULL 16 "nil", "function", "mark", "mark", "mark", "line", NULL
17}; 17};
18 18
19 19
20TObject luaO_nilobject = {LUA_T_NIL, {NULL}}; 20const TObject luaO_nilobject = {LUA_T_NIL, {NULL}};
21 21
22 22
23 23
24/* hash dimensions values */ 24/* hash dimensions values */
25static long dimensions[] = 25static const long dimensions[] =
26 {5L, 11L, 23L, 47L, 97L, 197L, 397L, 797L, 1597L, 3203L, 6421L, 26 {5L, 11L, 23L, 47L, 97L, 197L, 397L, 797L, 1597L, 3203L, 6421L,
27 12853L, 25717L, 51437L, 102811L, 205619L, 411233L, 822433L, 27 12853L, 25717L, 51437L, 102811L, 205619L, 411233L, 822433L,
28 1644817L, 3289613L, 6579211L, 13158023L, MAX_INT}; 28 1644817L, 3289613L, 6579211L, 13158023L, MAX_INT};
29 29
30 30
31int luaO_redimension (int oldsize) 31int luaO_redimension (int oldsize) {
32{
33 int i; 32 int i;
34 for (i=0; dimensions[i]<MAX_INT; i++) { 33 for (i=0; dimensions[i]<MAX_INT; i++) {
35 if (dimensions[i] > oldsize) 34 if (dimensions[i] > oldsize)
@@ -40,7 +39,7 @@ int luaO_redimension (int oldsize)
40} 39}
41 40
42 41
43int luaO_equalval (TObject *t1, TObject *t2) { 42int luaO_equalval (const TObject *t1, const TObject *t2) {
44 switch (ttype(t1)) { 43 switch (ttype(t1)) {
45 case LUA_T_NIL: return 1; 44 case LUA_T_NIL: return 1;
46 case LUA_T_NUMBER: return nvalue(t1) == nvalue(t2); 45 case LUA_T_NUMBER: return nvalue(t1) == nvalue(t2);
@@ -56,8 +55,7 @@ int luaO_equalval (TObject *t1, TObject *t2) {
56} 55}
57 56
58 57
59void luaO_insertlist (GCnode *root, GCnode *node) 58void luaO_insertlist (GCnode *root, GCnode *node) {
60{
61 node->next = root->next; 59 node->next = root->next;
62 root->next = node; 60 root->next = node;
63 node->marked = 0; 61 node->marked = 0;
@@ -90,7 +88,7 @@ static double expten (unsigned int e) {
90} 88}
91 89
92 90
93double luaO_str2d (char *s) { /* LUA_NUMBER */ 91double luaO_str2d (const char *s) { /* LUA_NUMBER */
94 double a = 0.0; 92 double a = 0.0;
95 int point = 0; 93 int point = 0;
96 while (isdigit((unsigned char)*s)) { 94 while (isdigit((unsigned char)*s)) {