Software /
code /
prosody
Annotate
util-src/table.c @ 6621:352fa2cae1c9
Merge 0.10->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 03 Apr 2015 19:34:47 +0100 |
parent | 6615:8e4572a642cb |
child | 7519:d278a770eddc |
rev | line source |
---|---|
6610
7c4cf87f4dff
util.table, Makefile: New C module that allows pre-allocation of tables to improve performance and decrease memory fragmentation
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 #include <lua.h> |
7c4cf87f4dff
util.table, Makefile: New C module that allows pre-allocation of tables to improve performance and decrease memory fragmentation
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 #include <lauxlib.h> |
7c4cf87f4dff
util.table, Makefile: New C module that allows pre-allocation of tables to improve performance and decrease memory fragmentation
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 |
7c4cf87f4dff
util.table, Makefile: New C module that allows pre-allocation of tables to improve performance and decrease memory fragmentation
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 static int Lcreate_table(lua_State* L) { |
7c4cf87f4dff
util.table, Makefile: New C module that allows pre-allocation of tables to improve performance and decrease memory fragmentation
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 lua_createtable(L, luaL_checkinteger(L, 1), luaL_checkinteger(L, 2)); |
7c4cf87f4dff
util.table, Makefile: New C module that allows pre-allocation of tables to improve performance and decrease memory fragmentation
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 return 1; |
7c4cf87f4dff
util.table, Makefile: New C module that allows pre-allocation of tables to improve performance and decrease memory fragmentation
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 } |
7c4cf87f4dff
util.table, Makefile: New C module that allows pre-allocation of tables to improve performance and decrease memory fragmentation
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 |
6615
8e4572a642cb
util-src/*.c: astyle --indent=tab --brackets=attach --indent-switches --break-blocks --pad-oper --unpad-paren --add-brackets --align-pointer=type --lineend=linux
Kim Alvefur <zash@zash.se>
parents:
6610
diff
changeset
|
9 int luaopen_util_table(lua_State* L) { |
6610
7c4cf87f4dff
util.table, Makefile: New C module that allows pre-allocation of tables to improve performance and decrease memory fragmentation
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 lua_newtable(L); |
7c4cf87f4dff
util.table, Makefile: New C module that allows pre-allocation of tables to improve performance and decrease memory fragmentation
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 lua_pushcfunction(L, Lcreate_table); |
7c4cf87f4dff
util.table, Makefile: New C module that allows pre-allocation of tables to improve performance and decrease memory fragmentation
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 lua_setfield(L, -2, "create"); |
7c4cf87f4dff
util.table, Makefile: New C module that allows pre-allocation of tables to improve performance and decrease memory fragmentation
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 return 1; |
7c4cf87f4dff
util.table, Makefile: New C module that allows pre-allocation of tables to improve performance and decrease memory fragmentation
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 } |