aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-04-06 11:17:06 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1997-04-06 11:17:06 -0300
commit00050b8a6b11c3ac2032ca147d236743b90f5168 (patch)
treea820a2562306a8a95a791364485e7de6867ae2ec
parent19a1e19ae1014d8afbfe4d8f49eb37e2f7df8f35 (diff)
downloadlua-00050b8a6b11c3ac2032ca147d236743b90f5168.tar.gz
lua-00050b8a6b11c3ac2032ca147d236743b90f5168.tar.bz2
lua-00050b8a6b11c3ac2032ca147d236743b90f5168.zip
detail: local names
-rw-r--r--strlib.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/strlib.c b/strlib.c
index 6aa726bc..b9e70782 100644
--- a/strlib.c
+++ b/strlib.c
@@ -3,7 +3,7 @@
3** String library to LUA 3** String library to LUA
4*/ 4*/
5 5
6char *rcs_strlib="$Id: strlib.c,v 1.39 1997/04/04 22:24:51 roberto Exp roberto $"; 6char *rcs_strlib="$Id: strlib.c,v 1.40 1997/04/06 14:08:08 roberto Exp roberto $";
7 7
8#include <string.h> 8#include <string.h>
9#include <stdio.h> 9#include <stdio.h>
@@ -24,7 +24,7 @@ struct lbuff {
24static struct lbuff lbuffer = {NULL, 0, 0}; 24static struct lbuff lbuffer = {NULL, 0, 0};
25 25
26 26
27static char *luaL_strbuffer (unsigned long size) 27static char *strbuffer (unsigned long size)
28{ 28{
29 if (size > lbuffer.max) { 29 if (size > lbuffer.max) {
30 /* ANSI "realloc" doesn't need this test, but some machines (Sun!) 30 /* ANSI "realloc" doesn't need this test, but some machines (Sun!)
@@ -39,14 +39,14 @@ static char *luaL_strbuffer (unsigned long size)
39 39
40static char *openspace (unsigned long size) 40static char *openspace (unsigned long size)
41{ 41{
42 char *buff = luaL_strbuffer(lbuffer.size+size); 42 char *buff = strbuffer(lbuffer.size+size);
43 return buff+lbuffer.size; 43 return buff+lbuffer.size;
44} 44}
45 45
46char *luaI_addchar (int c) 46char *luaI_addchar (int c)
47{ 47{
48 if (lbuffer.size >= lbuffer.max) 48 if (lbuffer.size >= lbuffer.max)
49 luaL_strbuffer(lbuffer.max == 0 ? 100 : lbuffer.max*2); 49 strbuffer(lbuffer.max == 0 ? 100 : lbuffer.max*2);
50 lbuffer.b[lbuffer.size++] = c; 50 lbuffer.b[lbuffer.size++] = c;
51 return lbuffer.b; 51 return lbuffer.b;
52} 52}
@@ -79,7 +79,7 @@ static void str_tok (void)
79 lua_Object t = lua_createtable(); 79 lua_Object t = lua_createtable();
80 int i = 1; 80 int i = 1;
81 /* As strtok changes s1, and s1 is "constant", make a copy of it */ 81 /* As strtok changes s1, and s1 is "constant", make a copy of it */
82 s1 = strcpy(luaL_strbuffer(strlen(s1+1)), s1); 82 s1 = strcpy(strbuffer(strlen(s1+1)), s1);
83 while ((s1 = strtok(s1, del)) != NULL) { 83 while ((s1 = strtok(s1, del)) != NULL) {
84 lua_pushobject(t); 84 lua_pushobject(t);
85 lua_pushnumber(i++); 85 lua_pushnumber(i++);