On Fri, Jan 18, 2013 at 5:01 AM, Ben Noordhuis <notifications@github.com>wrote:

> In src/luv_misc.c:
>
> > @@ -202,19 +212,24 @@ static void luv_on_signal(struct ev_loop *loop, struct ev_signal *w, int revents
> >  int luv_activate_signal_handler(lua_State* L) {
> >  #ifndef _WIN32
> >    int signal = luaL_checkint(L, 1);
> > -  struct ev_signal* signal_watcher = (struct ev_signal*)malloc(sizeof(struct ev_signal));
> > -  signal_watcher->data = L;
> > -  ev_signal_init (signal_watcher, luv_on_signal, signal);
> > -  struct ev_loop* loop = uv_default_loop()->ev;
> > -  ev_signal_start (loop, signal_watcher);
> > +  /* memory leek ? */
> > +  struct luv_signal_context* signal_watcher = (struct luv_signal_context*)malloc(sizeof(struct luv_signal_context));
>
> This is more a comment about the luvit style in general but the cast is
> superfluous in C and sizeof(struct luv_signal_context) is less safe than
> sizeof(*signal_watcher). That last one requires no additional effort - i.e.
> no addition room for bugs - when the type of signal_watcher changes.
>

I'm fine if the style changes.  Keep in mind I learned C while writing
luvit initially. I am not a C expert by any means.


>  —
> Reply to this email directly or view it on GitHub<https://github.com/luvit/luvit/pull/392/files#r2694077>.
>
>