function 'lua_createstring' moved from table.c to tree.c

This commit is contained in:
Roberto Ierusalimschy 1994-11-18 17:27:38 -02:00
parent feed56a01c
commit 73664eb739
4 changed files with 7 additions and 17 deletions

12
table.c
View File

@ -3,7 +3,7 @@
** Module to control static tables ** Module to control static tables
*/ */
char *rcs_table="$Id: table.c,v 2.19 1994/11/16 17:39:16 roberto Exp $"; char *rcs_table="$Id: table.c,v 2.20 1994/11/17 13:58:57 roberto Exp roberto $";
#include <string.h> #include <string.h>
@ -179,16 +179,6 @@ void lua_pack (void)
} }
/*
** If the string isn't allocated, allocate a new string at string tree.
*/
char *lua_createstring (char *s)
{
if (s == NULL) return NULL;
return lua_strcreate(s);
}
/* /*
** Add a file name at file table, checking overflow. This function also set ** Add a file name at file table, checking overflow. This function also set
** the external variable "lua_filename" with the function filename set. ** the external variable "lua_filename" with the function filename set.

View File

@ -1,7 +1,7 @@
/* /*
** Module to control static tables ** Module to control static tables
** TeCGraf - PUC-Rio ** TeCGraf - PUC-Rio
** $Id: table.h,v 2.6 1994/11/16 16:03:48 roberto Exp roberto $ ** $Id: table.h,v 2.7 1994/11/17 13:58:57 roberto Exp roberto $
*/ */
#ifndef table_h #ifndef table_h
@ -23,7 +23,6 @@ int luaI_findconstant (TreeNode *t);
void lua_travsymbol (void (*fn)(Object *)); void lua_travsymbol (void (*fn)(Object *));
void lua_markobject (Object *o); void lua_markobject (Object *o);
void lua_pack (void); void lua_pack (void);
char *lua_createstring (char *s);
char *lua_addfile (char *fn); char *lua_addfile (char *fn);
int lua_delfile (void); int lua_delfile (void);
char *lua_filename (void); char *lua_filename (void);

5
tree.c
View File

@ -3,7 +3,7 @@
** TecCGraf - PUC-Rio ** TecCGraf - PUC-Rio
*/ */
char *rcs_tree="$Id: tree.c,v 1.7 1994/11/16 18:09:11 roberto Exp roberto $"; char *rcs_tree="$Id: tree.c,v 1.8 1994/11/17 13:58:57 roberto Exp roberto $";
#include <string.h> #include <string.h>
@ -53,9 +53,10 @@ static TreeNode *tree_create (TreeNode **node, char *str)
} }
} }
char *lua_strcreate (char *str) char *lua_createstring (char *str)
{ {
StringNode *newString; StringNode *newString;
if (str == NULL) return NULL;
lua_pack(); lua_pack();
newString = (StringNode *)luaI_malloc(sizeof(StringNode)+strlen(str)); newString = (StringNode *)luaI_malloc(sizeof(StringNode)+strlen(str));
newString->mark = UNMARKED_STRING; newString->mark = UNMARKED_STRING;

4
tree.h
View File

@ -1,7 +1,7 @@
/* /*
** tree.h ** tree.h
** TecCGraf - PUC-Rio ** TecCGraf - PUC-Rio
** $Id: tree.h,v 1.3 1994/11/16 16:03:48 roberto Exp roberto $ ** $Id: tree.h,v 1.4 1994/11/17 13:58:57 roberto Exp roberto $
*/ */
#ifndef tree_h #ifndef tree_h
@ -28,7 +28,7 @@ typedef struct TreeNode
#define indexstring(s) (*(((Word *)s)-1)) #define indexstring(s) (*(((Word *)s)-1))
char *lua_strcreate (char *str); char *lua_createstring (char *str);
TreeNode *lua_constcreate (char *str); TreeNode *lua_constcreate (char *str);
int lua_strcollector (void); int lua_strcollector (void);
TreeNode *lua_varnext (char *n); TreeNode *lua_varnext (char *n);