Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

base: fixes event_callback handling of no return values better

  • Loading branch information...
commit 4ad6778dc1a9f03e18b5ec0d369c545c09390ab2 1 parent 1a1c026
@harningt authored
Showing with 5 additions and 1 deletion.
  1. +1 −0  CHANGELOG
  2. +4 −1 src/event_callback.c
View
1  CHANGELOG
@@ -1,4 +1,5 @@
0.4.1 - WIP
+ * Fixes event_callback handling to handle the no-return-value case better
* Cleans up timertest formatting
======
0.4.0 - 2012-04-10
View
5 src/event_callback.c
@@ -33,7 +33,10 @@ void luaevent_callback(int fd, short event, void* p) {
lua_call(L, 1, 2);
if(!cb->base)
return; /* event was destroyed during callback */
- ret = lua_tointeger(L, -2);
+ /* If nothing is returned, re-use the old event value */
+ ret = luaL_optinteger(L, -2, event);
+ /* Clone the old timeout value in case a new one wasn't set */
+ memcpy(&new_tv, &cb->timeout, sizeof(new_tv));
if(lua_isnumber(L, -1)) {
double newTimeout = lua_tonumber(L, -1);
if(newTimeout > 0) {
Please sign in to comment.
Something went wrong with that request. Please try again.