aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 60e28646..b90bf458 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.102 2003/05/16 18:59:08 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.103 2003/10/01 16:50:53 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*/
@@ -9,6 +9,7 @@
9#include <errno.h> 9#include <errno.h>
10#include <stdarg.h> 10#include <stdarg.h>
11#include <stdio.h> 11#include <stdio.h>
12#include <stdlib.h>
12#include <string.h> 13#include <string.h>
13 14
14 15
@@ -558,6 +559,22 @@ LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size,
558/* }====================================================== */ 559/* }====================================================== */
559 560
560 561
562static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
563 (void)ud;
564 if (nsize == 0) {
565 free(ptr);
566 return NULL;
567 }
568 else
569 return realloc(ptr, nsize);
570}
571
572
573LUALIB_API lua_State *luaL_newstate (void) {
574 return lua_newstate(l_alloc, NULL);
575}
576
577
561/* 578/*
562** {====================================================== 579** {======================================================
563** compatibility code 580** compatibility code