diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-18 17:27:38 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-18 17:27:38 -0200 |
commit | 73664eb7399655e7cf65132c91a1aa16191a1667 (patch) | |
tree | 733f88cc9444c2563989a1dd404c62c617dee926 | |
parent | feed56a01ccb9ca99271e0feca79f71aa5c38f8e (diff) | |
download | lua-73664eb7399655e7cf65132c91a1aa16191a1667.tar.gz lua-73664eb7399655e7cf65132c91a1aa16191a1667.tar.bz2 lua-73664eb7399655e7cf65132c91a1aa16191a1667.zip |
function 'lua_createstring' moved from table.c to tree.c
-rw-r--r-- | table.c | 12 | ||||
-rw-r--r-- | table.h | 3 | ||||
-rw-r--r-- | tree.c | 5 | ||||
-rw-r--r-- | tree.h | 4 |
4 files changed, 7 insertions, 17 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** Module to control static tables | 3 | ** Module to control static tables |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_table="$Id: table.c,v 2.19 1994/11/16 17:39:16 roberto Exp $"; | 6 | char *rcs_table="$Id: table.c,v 2.20 1994/11/17 13:58:57 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include <string.h> | 8 | #include <string.h> |
9 | 9 | ||
@@ -180,16 +180,6 @@ void lua_pack (void) | |||
180 | 180 | ||
181 | 181 | ||
182 | /* | 182 | /* |
183 | ** If the string isn't allocated, allocate a new string at string tree. | ||
184 | */ | ||
185 | char *lua_createstring (char *s) | ||
186 | { | ||
187 | if (s == NULL) return NULL; | ||
188 | return lua_strcreate(s); | ||
189 | } | ||
190 | |||
191 | |||
192 | /* | ||
193 | ** Add a file name at file table, checking overflow. This function also set | 183 | ** Add a file name at file table, checking overflow. This function also set |
194 | ** the external variable "lua_filename" with the function filename set. | 184 | ** the external variable "lua_filename" with the function filename set. |
195 | ** Return 0 on success or error message on error. | 185 | ** Return 0 on success or error message on error. |
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | ** Module to control static tables | 2 | ** Module to control static tables |
3 | ** TeCGraf - PUC-Rio | 3 | ** TeCGraf - PUC-Rio |
4 | ** $Id: table.h,v 2.6 1994/11/16 16:03:48 roberto Exp roberto $ | 4 | ** $Id: table.h,v 2.7 1994/11/17 13:58:57 roberto Exp roberto $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef table_h | 7 | #ifndef table_h |
@@ -23,7 +23,6 @@ int luaI_findconstant (TreeNode *t); | |||
23 | void lua_travsymbol (void (*fn)(Object *)); | 23 | void lua_travsymbol (void (*fn)(Object *)); |
24 | void lua_markobject (Object *o); | 24 | void lua_markobject (Object *o); |
25 | void lua_pack (void); | 25 | void lua_pack (void); |
26 | char *lua_createstring (char *s); | ||
27 | char *lua_addfile (char *fn); | 26 | char *lua_addfile (char *fn); |
28 | int lua_delfile (void); | 27 | int lua_delfile (void); |
29 | char *lua_filename (void); | 28 | char *lua_filename (void); |
@@ -3,7 +3,7 @@ | |||
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_tree="$Id: tree.c,v 1.7 1994/11/16 18:09:11 roberto Exp roberto $"; | 6 | char *rcs_tree="$Id: tree.c,v 1.8 1994/11/17 13:58:57 roberto Exp roberto $"; |
7 | 7 | ||
8 | 8 | ||
9 | #include <string.h> | 9 | #include <string.h> |
@@ -53,9 +53,10 @@ static TreeNode *tree_create (TreeNode **node, char *str) | |||
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | char *lua_strcreate (char *str) | 56 | char *lua_createstring (char *str) |
57 | { | 57 | { |
58 | StringNode *newString; | 58 | StringNode *newString; |
59 | if (str == NULL) return NULL; | ||
59 | lua_pack(); | 60 | lua_pack(); |
60 | newString = (StringNode *)luaI_malloc(sizeof(StringNode)+strlen(str)); | 61 | newString = (StringNode *)luaI_malloc(sizeof(StringNode)+strlen(str)); |
61 | newString->mark = UNMARKED_STRING; | 62 | newString->mark = UNMARKED_STRING; |
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | ** tree.h | 2 | ** tree.h |
3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
4 | ** $Id: tree.h,v 1.3 1994/11/16 16:03:48 roberto Exp roberto $ | 4 | ** $Id: tree.h,v 1.4 1994/11/17 13:58:57 roberto Exp roberto $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef tree_h | 7 | #ifndef tree_h |
@@ -28,7 +28,7 @@ typedef struct TreeNode | |||
28 | #define indexstring(s) (*(((Word *)s)-1)) | 28 | #define indexstring(s) (*(((Word *)s)-1)) |
29 | 29 | ||
30 | 30 | ||
31 | char *lua_strcreate (char *str); | 31 | char *lua_createstring (char *str); |
32 | TreeNode *lua_constcreate (char *str); | 32 | TreeNode *lua_constcreate (char *str); |
33 | int lua_strcollector (void); | 33 | int lua_strcollector (void); |
34 | TreeNode *lua_varnext (char *n); | 34 | TreeNode *lua_varnext (char *n); |