Re: [AD] al_unref_user_event

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Mon, 2009-08-10 at 13:43 -0500, Matthew Leverton wrote:
> void al_unref_user_event(ALLEGRO_USER_EVENT *event)
> 
> "This function does nothing if the event is not reference counted."
> 
> So this function is safe to call, even on Allegro generated events?
> Would it make more sense to call it al_unref_event(ALLEGRO_EVENT
> *event)?
> 
> I ask because I throw all of my event sources into the same queue,
> which leads to a large number of events, many of which I ignore. I
> don't know which events need to be unref'd or even if they are Allegro
> events because I don't want to check them all. So I call unref on
> every event, regardless of the source or type (mouse, keyboard, user,
> etc).
> 

Sounds reasonable. Internally, the code apparently calls this function a
lot already:

static void unref_if_user_event(ALLEGRO_EVENT *event)
{
   if (ALLEGRO_EVENT_TYPE_IS_USER(event->type)) {
      al_unref_user_event(&event->user);
   }
}

So we might as well rename it to al_unref_event and get rid of
al_unref_user_event.

-- 
Elias Pschernig <elias@xxxxxxxxxx>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/