diff options
author | Thomas Harning Jr <harningt@gmail.com> | 2007-09-21 12:55:28 -0400 |
---|---|---|
committer | Thomas Harning Jr <harningt@gmail.com> | 2007-09-21 12:55:28 -0400 |
commit | 68bd2b507fa935eb491479b10e53a97b17994cb5 (patch) | |
tree | b6ebe6e44dc5e3875cef1c2f37a43329375611b8 | |
parent | e54be68770789933411ec8e7e0d99876cb4ebb89 (diff) | |
download | luaevent-prosody-68bd2b507fa935eb491479b10e53a97b17994cb5.tar.gz luaevent-prosody-68bd2b507fa935eb491479b10e53a97b17994cb5.zip |
Exposed event_buffer checks/get/push operations in prep for buffer_event
-rw-r--r-- | include/event_buffer.h | 3 | ||||
-rw-r--r-- | src/event_buffer.c | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/event_buffer.h b/include/event_buffer.h index b34ea2d..a7b1525 100644 --- a/include/event_buffer.h +++ b/include/event_buffer.h @@ -14,5 +14,8 @@ typedef struct { } le_buffer; int event_buffer_register(lua_State* L); +int is_event_buffer(lua_State* L, int idx); +le_buffer* event_buffer_check(lua_State* L, int idx); +int event_buffer_push(lua_State* L, struct evbuffer* buffer); #endif diff --git a/src/event_buffer.c b/src/event_buffer.c index 72c6abe..7eb7260 100644 --- a/src/event_buffer.c +++ b/src/event_buffer.c @@ -18,7 +18,7 @@ static le_buffer* event_buffer_get(lua_State* L, int idx) { /* Obtains an le_buffer structure from a given index AND checks that it hadn't been prematurely freed */ -static le_buffer* event_buffer_check(lua_State* L, int idx) { +le_buffer* event_buffer_check(lua_State* L, int idx) { le_buffer* buf = (le_buffer*)luaL_checkudata(L, idx, EVENT_BUFFER_MT); if(!buf->buffer) luaL_argerror(L, idx, "Attempt to use closed event_buffer object"); @@ -26,7 +26,7 @@ static le_buffer* event_buffer_check(lua_State* L, int idx) { } /* Checks if the given index contains an le_buffer object */ -static int is_event_buffer(lua_State* L, int idx) { +int is_event_buffer(lua_State* L, int idx) { int ret; lua_getmetatable(L, idx); luaL_getmetatable(L, EVENT_BUFFER_MT); @@ -37,7 +37,7 @@ static int is_event_buffer(lua_State* L, int idx) { /* TODO: Use lightuserdata mapping to locate hanging object instances */ /* Pushes the specified evbuffer object onto the stack, attaching a metatable to it */ -static int event_buffer_push(lua_State* L, struct evbuffer* buffer) { +int event_buffer_push(lua_State* L, struct evbuffer* buffer) { le_buffer *buf = (le_buffer*)lua_newuserdata(L, sizeof(le_buffer)); buf->buffer = buffer; luaL_getmetatable(L, EVENT_BUFFER_MT); |