mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
Apply suggestions from @henrygab
Check if memory allocation fails Fix memory leak Initialize struct in declaration Add/Fix some notes Remove unlikely() in favor of readability Remove a hard-coded magic number
This commit is contained in:
parent
835b7a9150
commit
3ee13c9ba6
12 changed files with 113 additions and 44 deletions
|
@ -298,6 +298,8 @@ int BUTTON_HELD(int ms) {
|
|||
return BUTTON_ERROR;
|
||||
}
|
||||
|
||||
// This function returns false if no data is available or
|
||||
// the USB connection is invalid.
|
||||
bool data_available(void) {
|
||||
#ifdef WITH_FPC_USART_HOST
|
||||
return usb_poll_validate_length() || (usart_rxdata_available() > 0);
|
||||
|
@ -306,6 +308,9 @@ bool data_available(void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
// This function doesn't check if the USB connection is valid.
|
||||
// In most of the cases, you should use data_available() unless
|
||||
// the timing is critical.
|
||||
bool data_available_fast(void) {
|
||||
#ifdef WITH_FPC_USART_HOST
|
||||
return usb_available_length() || (usart_rxdata_available() > 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue