Small tweak for the new ignore function.

This commit is contained in:
Jonathan Protzenko 2015-09-16 12:08:09 -07:00
parent 3158445208
commit 78ad8a1646
2 changed files with 4 additions and 3 deletions

View file

@ -177,7 +177,7 @@ class MicroBitMessageBus : public MicroBitComponent
* uBit.MessageBus.ignore(MICROBIT_ID_BUTTON_B, MICROBIT_BUTTON_EVT_CLICK, onButtonBClick);
* @endcode
*/
void ignore(int id, int value, void (*handler)(MicroBitEvent, void*), void* arg);
void ignore(int id, int value, void (*handler)(MicroBitEvent, void*));
/**
* Unregister a listener function.

View file

@ -341,12 +341,13 @@ void MicroBitMessageBus::ignore(int id, int value, void (*handler)(MicroBitEvent
* uBit.MessageBus.ignore(MICROBIT_ID_BUTTON_B, MICROBIT_BUTTON_EVT_CLICK, onButtonBClick);
* @endcode
*/
void MicroBitMessageBus::ignore(int id, int value, void (*handler)(MicroBitEvent, void*), void* arg)
void MicroBitMessageBus::ignore(int id, int value, void (*handler)(MicroBitEvent, void*))
{
if (handler == NULL)
return;
MicroBitListener listener(id, value, handler, arg);
// The remove function is not comparing the [arg] anyhow.
MicroBitListener listener(id, value, handler, NULL);
remove(&listener);
}