File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,10 @@ CAN_COMMON::CAN_COMMON(int numFilt)
60
60
numFilters = numFilt;
61
61
// Official entry for the worst, most convoluted looking C++ line ever written.
62
62
// Dynamically allocate enough space for the function pointers with a hideous malloc call.
63
- *cbCANFrame = (void (*)(CAN_FRAME *))malloc (sizeof (void (*)(CAN_FRAME *)) * numFilters);
63
+ // cbCANFrame = malloc(4 * numFilters);
64
+ memset (cbCANFrame, 0 , 4 * numFilters);
65
+ cbGeneral = 0 ;
66
+ for (int i = 0 ; i < SIZE_LISTENERS; i++) listener[i] = 0 ;
64
67
}
65
68
66
69
uint32_t CAN_COMMON::begin ()
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ class CAN_COMMON
131
131
protected:
132
132
CANListener *listener[SIZE_LISTENERS];
133
133
void (*cbGeneral)(CAN_FRAME *); // general callback if no per-mailbox or per-filter entries matched
134
- void (** cbCANFrame)(CAN_FRAME *); // array of function pointers - disgusting syntax though.
134
+ void (*cbCANFrame[ 16 ] )(CAN_FRAME *); // array of function pointers - disgusting syntax though.
135
135
uint32_t busSpeed;
136
136
int numFilters;
137
137
};
You can’t perform that action at this time.
0 commit comments