Mercurial > prosody-hg
comparison util-src/ringbuffer.c @ 7969:1c6a07606309
util-src: Specify size of various tables to be allocated
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 09 Mar 2017 01:20:59 +0100 |
| parents | 8067828e7e40 |
| children | 0e1d8f2f02bf |
comparison
equal
deleted
inserted
replaced
| 7968:f0e35f4db9e0 | 7969:1c6a07606309 |
|---|---|
| 185 lua_pushcfunction(L, rb_tostring); | 185 lua_pushcfunction(L, rb_tostring); |
| 186 lua_setfield(L, -2, "__tostring"); | 186 lua_setfield(L, -2, "__tostring"); |
| 187 lua_pushcfunction(L, rb_length); | 187 lua_pushcfunction(L, rb_length); |
| 188 lua_setfield(L, -2, "__len"); | 188 lua_setfield(L, -2, "__len"); |
| 189 | 189 |
| 190 lua_newtable(L); /* __index */ | 190 lua_createtable(L, 0, 7); /* __index */ |
| 191 { | 191 { |
| 192 lua_pushcfunction(L, rb_find); | 192 lua_pushcfunction(L, rb_find); |
| 193 lua_setfield(L, -2, "find"); | 193 lua_setfield(L, -2, "find"); |
| 194 lua_pushcfunction(L, rb_read); | 194 lua_pushcfunction(L, rb_read); |
| 195 lua_setfield(L, -2, "read"); | 195 lua_setfield(L, -2, "read"); |
| 205 lua_setfield(L, -2, "free"); | 205 lua_setfield(L, -2, "free"); |
| 206 } | 206 } |
| 207 lua_setfield(L, -2, "__index"); | 207 lua_setfield(L, -2, "__index"); |
| 208 } | 208 } |
| 209 | 209 |
| 210 lua_newtable(L); | 210 lua_createtable(L, 0, 1); |
| 211 lua_pushcfunction(L, rb_new); | 211 lua_pushcfunction(L, rb_new); |
| 212 lua_setfield(L, -2, "new"); | 212 lua_setfield(L, -2, "new"); |
| 213 return 1; | 213 return 1; |
| 214 } | 214 } |
