aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 4ad7e0a2..65b1def3 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.82 2002/08/06 18:01:50 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.83 2002/08/08 20:08:41 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -208,27 +208,27 @@ static int emptybuffer (luaL_Buffer *B) {
208 else { 208 else {
209 lua_pushlstring(B->L, B->buffer, l); 209 lua_pushlstring(B->L, B->buffer, l);
210 B->p = B->buffer; 210 B->p = B->buffer;
211 B->level++; 211 B->lvl++;
212 return 1; 212 return 1;
213 } 213 }
214} 214}
215 215
216 216
217static void adjuststack (luaL_Buffer *B) { 217static void adjuststack (luaL_Buffer *B) {
218 if (B->level > 1) { 218 if (B->lvl > 1) {
219 lua_State *L = B->L; 219 lua_State *L = B->L;
220 int toget = 1; /* number of levels to concat */ 220 int toget = 1; /* number of levels to concat */
221 size_t toplen = lua_strlen(L, -1); 221 size_t toplen = lua_strlen(L, -1);
222 do { 222 do {
223 size_t l = lua_strlen(L, -(toget+1)); 223 size_t l = lua_strlen(L, -(toget+1));
224 if (B->level - toget + 1 >= LIMIT || toplen > l) { 224 if (B->lvl - toget + 1 >= LIMIT || toplen > l) {
225 toplen += l; 225 toplen += l;
226 toget++; 226 toget++;
227 } 227 }
228 else break; 228 else break;
229 } while (toget < B->level); 229 } while (toget < B->lvl);
230 lua_concat(L, toget); 230 lua_concat(L, toget);
231 B->level = B->level - toget + 1; 231 B->lvl = B->lvl - toget + 1;
232 } 232 }
233} 233}
234 234
@@ -253,8 +253,8 @@ LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) {
253 253
254LUALIB_API void luaL_pushresult (luaL_Buffer *B) { 254LUALIB_API void luaL_pushresult (luaL_Buffer *B) {
255 emptybuffer(B); 255 emptybuffer(B);
256 lua_concat(B->L, B->level); 256 lua_concat(B->L, B->lvl);
257 B->level = 1; 257 B->lvl = 1;
258} 258}
259 259
260 260
@@ -269,7 +269,7 @@ LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
269 else { 269 else {
270 if (emptybuffer(B)) 270 if (emptybuffer(B))
271 lua_insert(L, -2); /* put buffer before new value */ 271 lua_insert(L, -2); /* put buffer before new value */
272 B->level++; /* add new value into B stack */ 272 B->lvl++; /* add new value into B stack */
273 adjuststack(B); 273 adjuststack(B);
274 } 274 }
275} 275}
@@ -278,7 +278,7 @@ LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
278LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { 278LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {
279 B->L = L; 279 B->L = L;
280 B->p = B->buffer; 280 B->p = B->buffer;
281 B->level = 0; 281 B->lvl = 0;
282} 282}
283 283
284/* }====================================================== */ 284/* }====================================================== */