Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions libraries/CurieBLE/src/BLEPeripheral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "BLEPeripheral.h"

static BLEPeripheralEventHandler m_eventHandlers[BLEDeviceLastEvent];
static BLEPeripheralEventHandler m_eventHandlers[BLEDeviceLastEvent] = {NULL, NULL, NULL, NULL};
Copy link
Contributor

@eriknyquist eriknyquist Feb 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unncessary-- m_evenHandlers is declared static, so it will be located in .bss
All elements will be initialized to 0 by default, so there is no need to explicitly initialize.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. The global variable is in _bss segment and it is clear out on boot. In addition, the initialization is hard code to 4 which may not be true in future.

@sgbihu , please remove the initialization, stay with the previous code for this item. Please make the correction and make another push ASAP. Pencil down this Friday.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eriknyquist , correction made and it is in a new PR, #455.


void bleBackCompatiblePeripheralConnectHandler(BLEDevice central)
{
Expand Down Expand Up @@ -154,7 +154,6 @@ void BLEPeripheral::init()
if (!_initCalled)
{
BLE.begin();
memset(m_eventHandlers, 0, sizeof(m_eventHandlers));
_initCalled = true;
}
}
Expand Down