All pastes #23092 Raw Edit

Stuff

public text v1 · immutable
#23092 ·published 2005-09-16 14:09 UTC
rendered paste body
static void     
ewl_callback_rm(Ewl_Widget *w, Ewl_Callback_Type t, unsigned int pos)
{       
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);

        /* deal with the direct case first */
        if (w->callbacks[t].mask & EWL_CALLBACK_TYPE_DIRECT)
        {
                w->callbacks[t].len = 0;
                w->callbacks[t].list = NULL;
                EWL_CALLBACK_SET_NODIRECT(w, t);
        
                DRETURN(DLEVEL_STABLE);
        }
        w->callbacks[t].len -= 1;

        /* removing first */
        if (pos == 0)
        {
                memmove(w->callbacks[t].list,
                        w->callbacks[t].list + 1,
                        w->callbacks[t].len * sizeof(void *));
        }
        else if (pos != EWL_CALLBACK_LEN(w, t))
        {
                /* not last position */
                memmove(w->callbacks[t].list + pos,
                        w->callbacks[t].list + (pos + 1),
                        (w->callbacks[t].len - pos) * sizeof(void *));
        }
        
        w->callbacks[t].list = realloc(w->callbacks[t].list,
                                        w->callbacks[t].len);

        DLEAVE_FUNCTION(DLEVEL_STABLE);
}